locked
Why values is not passing in my controller insert method? RRS feed

  • Question

  •  public ActionResult InsertVesselDetails([DataSourceRequest] DataSourceRequest request,
                [Bind(Prefix = "models")]IEnumerable<User> InsertedDetails, Int64? VesselId, Int64? UserId)
            {

                PlanRightsService _service = new PlanRightsService();
                try
                {
                    if (InsertedDetails != null)
                    {
                        PlanRightsRequest Request = new PlanRightsRequest();


                        List<PlanRightsDTO> PlanRightDto = new List<PlanRightsDTO>();
                        PlanRightDto = InsertedDetails.Select(p => new PlanRightsDTO
                        {
                            ID = p.ID,
                            UserId = UserId,
                            VesselId = VesselId,
                            RANK_GROUP_ID = p.RANK_GROUP_ID,
                            PLAN_USER = p.PLAN_USER == true ? "Y" : "N",
                            INTER_APPROVER = p.INTER_APPROVER == true ? "Y" : "N",
                            FINAL_APPROVER = p.FINAL_APPROVER == true ? "Y" : "N",


                        }).ToList();

                        Request.InsertedPositions = PlanRightDto;
                        _planRightsService.InsertVesselDetails(Request, UserId, VesselId);



                    }


                    return Json(new { Success = true });
                }
                catch (Exception ex)
                {
                    bool rethrow = UserInterfaceExceptionHandler.HandleExcetion(ref ex, CurrentUserData.UserId.ToString(), "");
                    //throw ex;
                    //    ModelState.AddModelError("Error", ex.Message);
                    return Json(new { Success = false });
                }


            }
    Wednesday, June 26, 2013 6:30 AM