public object DeleteTaluka(TalukaParam PM) { try { Tbl_Taluka obj = db.Tbl_Taluka.Where(r => r.TalukaID == PM.TalukaID).FirstOrDefault(); if (obj.Status == 1) { obj.Status = 0; } else { obj.Status = 1; } db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "Taluka Deactivated Successfully." }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object TalukaUpdate(TalukaParam b) { if (b.Taluka == null) { return(new Error() { IsError = true, Message = "Required Taluka" }); } var data = db.Tbl_Taluka.Where(r => r.TalukaID == b.TalukaID).FirstOrDefault(); try { Tbl_Taluka obj = new Tbl_Taluka(); data.Taluka = b.Taluka; data.DistrictID = b.DistrictID; data.ModifiedBy = null; data.ModifiedDate = System.DateTime.Today.Date; db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "Update Taluka" }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object DeleteTaluka([FromBody] TalukaParam PM) { try { StateBusiness b = new StateBusiness(); var Result = b.DeleteTaluka(PM); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object AddTaluka([FromBody] TalukaParam obj) { try { StateBusiness save = new StateBusiness(); var result = save.SaveTaluka(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetStateUnderTaluka([FromBody] TalukaParam d) { try { StateBusiness state = new StateBusiness(); var Result = state.GetStateunderDistrict(d); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object UpdateTaluka(TalukaParam b) { try { StateBusiness taluka = new StateBusiness(); var Result = taluka.TalukaUpdate(b); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetSingleTaluka(TalukaParam b) { try { var taluka = db.ViewTalukaLists.Where(r => r.TalukaID == b.TalukaID && r.Status == 1).FirstOrDefault(); return(new Result() { IsSucess = true, ResultData = taluka }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
//Taluka public object SaveTaluka(TalukaParam b) { if (b.Taluka == null) { return(new Error() { IsError = true, Message = "Required Taluka" }); } var data = db.Tbl_Taluka.FirstOrDefault(r => r.Taluka == b.Taluka); if (data != null) { return(new Error() { IsError = true, Message = "Duplicate Entry Not Allowed" }); } try { Tbl_Taluka obj = new Tbl_Taluka(); obj.Taluka = b.Taluka; obj.DistrictID = b.DistrictID; obj.Status = 1; obj.CreatedBy = 1; obj.CreatedDate = System.DateTime.Today.Date; obj.ModifiedBy = null; obj.ModifiedDate = System.DateTime.Today.Date; db.Tbl_Taluka.Add(obj); db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "Created Taluka" }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetStateunderDistrict(TalukaParam p) { try { List <ViewDistrictList> Info = null; var data = db.ViewDistrictLists.Where(r => r.Status == 1 && r.StateID == p.StateId).ToList(); if (data == null) { Info = db.ViewDistrictLists.Where(r => r.Status == 1).ToList(); return(Info); } return(data); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }