Exemplo n.º 1
0
        public ActionResult Edit(CustomerTypeModel model)
        {
            if (ModelState.IsValid)
            {
                bool has_error = false;

                if (!has_error)
                {
                    try {
                        var type = CustomerTypeModelConverter.FromModel(model);
                        CustomerTypeService.Update(type);
                    }
                    catch (DomainException e) {
                        ModelState.AddModelError("", e);
                        has_error = true;
                    }
                }

                if (!has_error)
                {
                    return(RedirectToAction("List"));
                }
            }
            return(View());
        }
Exemplo n.º 2
0
        //
        // GET: /Directory/
        public ActionResult List()
        {
            List <CustomerTypeModel> items = new List <CustomerTypeModel>();

            foreach (var item in CustomerTypeService.GetAllTypes())
            {
                items.Add(CustomerTypeModelConverter.ToModel(item));
            }

            return(View(items));
        }
Exemplo n.º 3
0
        public ActionResult Delete(Int64 id)
        {
            var type = CustomerTypeService.GetTypeById(id);

            if (type == null)
            {
                ModelState.AddModelError("", "Вид деятельности не найден");
                return(RedirectToAction("List"));
            }

            var model = CustomerTypeModelConverter.ToModel(type);

            return(View(model));
        }