public ActionResult DeleteConfirmed(int id) { LocalGovernment localGovernment = db.LocalGoverments.Find(id); db.LocalGoverments.Remove(localGovernment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Code")] LocalGovernment localGovernment) { if (ModelState.IsValid) { db.Entry(localGovernment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(localGovernment)); }
public ActionResult Create([Bind(Include = "Id,Name,Code")] LocalGovernment localGovernment) { if (ModelState.IsValid) { db.LocalGoverments.Add(localGovernment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(localGovernment)); }
private void SetViewLocalGovt(LocalGovernment selectedLGA) { IEnumerable <LocalGovernment> values = Enum.GetValues(typeof(LocalGovernment)).Cast <LocalGovernment>(); IEnumerable <SelectListItem> items = from value in values select new SelectListItem { Text = value.ToString(), Value = value.ToString(), Selected = value == selectedLGA, }; ViewBag.LGAs = items; }
// GET: LocalGovernments/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocalGovernment localGovernment = db.LocalGoverments.Find(id); if (localGovernment == null) { return(HttpNotFound()); } return(View(localGovernment)); }
public IActionResult Put([FromBody] LocalGovernment value) { try { if (String.IsNullOrEmpty(value.Name)) { return(Ok(new { responseCode = 500, responseDescription = "Kindly Supply Cost Center Code" })); } var getbal = LocalGovernmentService.GetLocalGovernmentByCode(value.Name.Trim()).Result; getbal.Description = value.Description; LocalGovernmentService.UpdateLocalGovernment(getbal); return(Ok(new { responseCode = 200, responseDescription = "Updated Successfully" })); } catch (Exception ex) { return(Ok(new { responseCode = 500, responseDescription = "Failed" })); } }
public IActionResult createLocalGovernment([FromBody] LocalGovernment value) { try { if (String.IsNullOrEmpty(value.Name)) { return(Ok(new { responseCode = 500, responseDescription = "Kindly Supply Code" })); } if (LocalGovernmentService.GetLocalGovernmentByCode(value.Name.Trim()).Result != null) { return(Ok(new { responseCode = 400, responseDescription = "Code already Exist" })); } // value.datecreated = DateTime.Now; LocalGovernmentService.AddLocalGovernment(value); return(Ok(new { responseCode = 200, responseDescription = "Created Successfully" })); } catch (Exception ex) { return(Ok(new { responseCode = 500, responseDescription = "Failed" })); } }
public void RemoveLocalGovernment(LocalGovernment bl_sheet) { unitOfWork.LocalGovernments.Remove(bl_sheet); unitOfWork.Done(); }
public async Task <bool> UpdateLocalGovernment(LocalGovernment balsheet) { unitOfWork.LocalGovernments.Update(balsheet); return(await unitOfWork.Done()); }