public PanchayatDto GetByID(int panchayatId) { List <uspPanchayatGetByPanchayatId_Result> lstuspPanchayatGetByPanchayatId_Result = _dbContext.uspPanchayatGetByPanchayatId(panchayatId).ToList(); PanchayatDto PanchayatDto = Mapper.Map <uspPanchayatGetByPanchayatId_Result, PanchayatDto>(lstuspPanchayatGetByPanchayatId_Result.FirstOrDefault()); return(PanchayatDto); }
public ActionResult CreatePanchayat(string Id) { int PanchayatId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString()); PanchayatDto objPanchayatDto = new PanchayatDto(); if (PanchayatId > 0) { objPanchayatDto = _PanchayatService.GetByID(PanchayatId); } PanchayatModel panchayatModel = Mapper.Map <PanchayatDto, PanchayatModel>(objPanchayatDto); LoanDropDowns(panchayatModel.StateID, panchayatModel.DistrictID, panchayatModel.MandalID, panchayatModel.ClusterID, panchayatModel.VillageID); ViewBag.Result = new ResultDto(); return(View(panchayatModel)); }
/* #region DropDownsBinding * public List<SelectListDto> GetClustersList() * { * List<SelectListDto> lstSelectListDto = new List<SelectListDto>(); * List<uspClusterGetAll_Result> lstuspClusterGetAll_Result = _dbContext.uspClusterGetAll().ToList(); * foreach (var cluster in lstuspClusterGetAll_Result) * { * SelectListDto objSelectListDto = new SelectListDto() * { * ID = cluster.ClusterID, * Text = cluster.ClusterName * }; * lstSelectListDto.Add(objSelectListDto); * } * return lstSelectListDto; * } * * public List<SelectListDto> GetVillageSelectList() * { * List<SelectListDto> lstSelectListDto = new List<SelectListDto>(); * List<uspVillageGetAll_Result> lstuspVillageGetAll_Result = _dbContext.uspVillageGetAll().ToList(); * foreach (var village in lstuspVillageGetAll_Result) * { * SelectListDto objSelectListDto = new SelectListDto() * { * ID = village.VillageID, * Text = village.Village * }; * lstSelectListDto.Add(objSelectListDto); * } * return lstSelectListDto; * } * #endregion */ private ResultDto InsertUpdate(PanchayatDto Panchayatdto) { ResultDto resultDto = new ResultDto(); string objectName = "panchayat"; try { Panchayatdto.PanchayatCode = string.Empty; ObjectParameter paramPanchayatId = new ObjectParameter("PanchayatID", Panchayatdto.PanchayatID); ObjectParameter paramPanchayatCode = new ObjectParameter("PanchayatCode", Panchayatdto.PanchayatCode); int effectedCount = _dbContext.uspPanchayatInsertUpdate(paramPanchayatId, Panchayatdto.PanchayatName, Panchayatdto.TEPanchayatName, Panchayatdto.VillageID, Panchayatdto.UserId, paramPanchayatCode); resultDto.ObjectId = (int)paramPanchayatId.Value; resultDto.ObjectCode = (string)paramPanchayatCode.Value; if (resultDto.ObjectId > 0) { resultDto.Message = string.Format("{0} details saved successfully with code : {1}", objectName, resultDto.ObjectCode); } else if (resultDto.ObjectId == -1) { resultDto.Message = string.Format("Error occured while generating {0} code", objectName); } else { resultDto.Message = string.Format("Error occured while saving {0} details", objectName); } } catch (Exception) { resultDto.Message = "Service layer error occured while saving the Panchayat details"; resultDto.Message = "Service layer error occured while saving the Panchayat details"; resultDto.Message = string.Format("Service layer error occured while saving the {0} details", objectName); resultDto.ObjectId = -98; } return(resultDto); }
public ResultDto Insert(PanchayatDto PanchayatDto) { return(InsertUpdate(PanchayatDto)); }