public ActionResult Add() { ViewBag.Message = "Your application description page."; var model = new TblYardCheck(); return(View(model)); }
public ActionResult PostSave(TblYardCheck request) { request.AddedOn = DateTime.Now; request.ModifiedOn = DateTime.Now; var response = _repository.Create(request); return(RedirectToAction("Index")); }
public TblYardCheck Create(TblYardCheck request) { try { _context.TblYardChecks.Add(request); _context.SaveChanges(); return(request); } catch (Exception x) { throw new Exception(x.Message); } }
public TblYardCheck Update(TblYardCheck request) { try { _context.TblYardChecks.Attach(request); _context.Entry(request).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); return(request); } catch (Exception x) { throw new Exception(x.Message); } }
public JsonResult SaveYardCheck(string yardCheck, int opr) { var obj = JsonConvert.DeserializeObject <TblYardCheck>(yardCheck); var response = new TblYardCheck(); if (opr == 1) { obj.AddedOn = DateTime.Now; obj.ModifiedOn = DateTime.Now; response = _repository.Update(obj); } else { obj.AddedOn = DateTime.Now; obj.ModifiedOn = DateTime.Now; response = _repository.Create(obj); } return(Json(response)); }