public ActionResult CreateLeadership(LeadershipModel leaderModel) { LeadershipModel lmodel = new LeadershipModel(); LoadDropDowns(lmodel.BranchID, lmodel.ClusterID, lmodel.GroupID); var resultDto = new ResultDto(); if (ModelState.IsValid) { var leadershipDto = Mapper.Map <LeadershipModel, LeadershipDto>(leaderModel); leadershipDto.UserID = UserInfo.UserID; if (leadershipDto.LeadershipID == 0) { resultDto = _leadershipService.Insert(leadershipDto); } else { resultDto = _leadershipService.Update(leadershipDto); } if (resultDto.ObjectId > 0) { leadershipDto = _leadershipService.GetByID(resultDto.ObjectId); leaderModel = Mapper.Map <LeadershipDto, LeadershipModel>(leadershipDto); resultDto.ObjectId = leaderModel.LeadershipID; } } ViewBag.Result = resultDto; return(View(leaderModel)); }
public ActionResult CreateLeadership(string id) { int LeadershipId = string.IsNullOrEmpty(id.DecryptString()) ? default(int) : Convert.ToInt32(id.DecryptString()); LeadershipModel lmodel = new LeadershipModel(); LeadershipDto dto = new LeadershipDto(); if (LeadershipId > 0) { dto = _leadershipService.GetByID(LeadershipId); } lmodel = Mapper.Map <LeadershipDto, LeadershipModel>(dto); //lmodel.ClusterID = clusterId; LoadDropDowns(lmodel.BranchID, lmodel.ClusterID, lmodel.GroupID); return(View(lmodel)); }