public async Task <ActionResult> DivisionDataIndex(DivisionDataModel divisionDataModel, String sessionid) { ViewBag.SessionID = sessionid; if (Authenticate("DivisionData")) { try { if (ModelState.IsValid) { divisionDataDbContext.DivisionDataDbSet.Add(divisionDataModel); await divisionDataDbContext.SaveChangesAsync(); return(RedirectToAction("DivisionDataIndex", new { sessionid = ViewBag.SessionID })); } } catch { Response.Write("<script > alert('Server Error!!');</ script >"); ViewBag.errormssg = "Server Error!!"; } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } return(Redirect(new Uri(Request.Url, Url.Action("AuthenticationError", "Error", new { sessionid = ViewBag.SessionID })).ToString())); }
public async Task <JsonResult> DivisionDataDelete(string divname, string sessionid) { ViewBag.SessionID = sessionid; if (Authenticate("DivisionData")) { try { if (divname != null) { DivisionDataModel divisionDataModel = await divisionDataDbContext.DivisionDataDbSet.Where(model => model.divname.Equals(divname)).FirstOrDefaultAsync(); divisionDataDbContext.DivisionDataDbSet.Remove(divisionDataModel); await divisionDataDbContext.SaveChangesAsync(); return(Json("success")); } } catch { return(Json("fail")); } } return(Json("fail")); }