Exemplo n.º 1
0
        public ActionResult CreateService(service service)
        {
            //validation check
            var name1 = services.GetAll().Where(s => s.description.ToUpper().Contains(service.description.ToUpper())).ToList();

            var _service = new service();
            _service.description = service.description;
            _service.createDate = DateTime.Now;
            _service.lastUpdate = DateTime.Now;

            //code and name validation

            if (_service.description == null)
            {
                return RedirectToAction("ErrorMessage");
            }
            else if (_service.description.Trim().Length > 20)
            {
                return RedirectToAction("ErrorMessage");
            }
            else if (name1.Count() > 0)
            {
                return RedirectToAction("ErrorMessage");
            }

            services.Insert(_service);
            services.Commit();

            return RedirectToAction("Index");
        }
Exemplo n.º 2
0
        public ActionResult CreateService(service service)
        {
            var _service = new service();
            _service.description = service.description;
            _service.createDate = DateTime.Now;
            _service.lastUpdate = DateTime.Now;
            services.Insert(_service);
            services.Commit();

            return RedirectToAction("Index");
        }
Exemplo n.º 3
0
 // GET: /Create
 public ActionResult CreateService()
 {
     var service = new service();
     return View(service);
 }
Exemplo n.º 4
0
        public ActionResult EditService(service service)
        {
            var _service = services.GetById(service.ID);

            _service.description = service.description;
            _service.lastUpdate = DateTime.Now;
            services.Update(_service);
            services.Commit();

            return RedirectToAction("Index");
        }