Esempio n. 1
0
        public IActionResult Create()
        {
            ServicesCreateVM model = new ServicesCreateVM
            {
            };

            return(PartialView("_Create", model));
        }
Esempio n. 2
0
        public IActionResult Create(ServicesCreateVM model)
        {
            if (!ModelState.IsValid)
            {
                Response.StatusCode = 400;
                return(PartialView("_Create", model));
            }

            try
            {
                Service service = new Service();
                service.CopyObject(model);

                _context.Services.Add(service);
                _context.SaveChanges();

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                return(PartialView("_Create", model));
            }
        }