Пример #1
0
        public ActionResult Add()
        {
            ViewBag.Message = "Your application description page.";
            var model = new TblYardCheck();

            return(View(model));
        }
Пример #2
0
        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);
     }
 }
Пример #5
0
        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));
        }