예제 #1
0
        public ActionResult Create(HairStyleViewModel hairStyle)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _hairStyleRepository.Insert(hairStyle.GetOriginalSource());

                    return RedirectToAction("Index");
                }

                return View();
            }
            catch (Exception ex)
            {
                return View();
            }
        }
예제 #2
0
        public ActionResult Edit(int id, HairStyleViewModel hairStyle)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var source = hairStyle.GetOriginalSource();

                    source.id = id;

                    _hairStyleRepository.Update(source);

                    return RedirectToAction("Index");
                }

                return View();
            }
            catch (Exception ex)
            {
                return View();
            }
        }