Exemple #1
0
        // GET: CosmeticService
        public ActionResult Update(int id)
        {
            var cosmeticServicemodel = new CosmeticServiceModel();

            var cosmeticService = cosmeticServiceService.GetByIdCosmeticService(id);

            cosmeticServicemodel.Id          = cosmeticService.Id;
            cosmeticServicemodel.Nameservice = cosmeticService.Nameservice;
            cosmeticServicemodel.Price       = cosmeticService.Price;

            return(View("Update", cosmeticServicemodel));
        }
Exemple #2
0
        public ActionResult Update(CosmeticServiceModel cosmeticServicemodel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Update", cosmeticServicemodel));
            }
            ;

            CosmeticService cosmeticService = new CosmeticService();

            cosmeticService.Id          = cosmeticServicemodel.Id.HasValue ? cosmeticServicemodel.Id.Value : 0;
            cosmeticService.Nameservice = cosmeticServicemodel.Nameservice;
            cosmeticService.Price       = cosmeticServicemodel.Price;
            cosmeticServiceService.Edit(cosmeticService);

            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult Create(CosmeticServiceModel cosmeticServicemodel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Create", cosmeticServicemodel));
            }
            ;

            CosmeticService cosmeticService = new CosmeticService();

            if (cosmeticServicemodel.Id != null)
            {
                Console.WriteLine("Error");
            }

            cosmeticService.Id          = cosmeticServicemodel.Id.HasValue ? cosmeticServicemodel.Id.Value : 0;
            cosmeticService.Nameservice = cosmeticServicemodel.Nameservice;
            cosmeticService.Price       = cosmeticServicemodel.Price;
            cosmeticServiceService.Create(cosmeticService);

            return(RedirectToAction("Index"));
        }
Exemple #4
0
        // GET: CosmeticService
        public ActionResult Create(int id = 0)
        {
            var cosmeticServicemodel = new CosmeticServiceModel();

            return(View("Create", cosmeticServicemodel));
        }