public ActionResult Create(BillTypeFormModel model)
 {
     if (ModelState.IsValid)
     {
         if (_billTypeService.GetBillTypesByName(model.TypeName).Count() > 0)
         {
             ModelState.AddModelError("", "Введенное наименование уже существует, введите другое.");
             return View(model);
         }
         var entity = Mapper.Map<BillType>(model);
         _billTypeService.CreateBillType(entity);
         _billTypeService.SaveBillType();
         return RedirectToAction("Index");
     }
     return View(model);
 }
 public ActionResult Edit(BillTypeFormModel model)
 {
     var entity = _billTypeService.GetBillType(model.Id);
     if (entity == null)
         return HttpNotFound();
     if(ModelState.IsValid)
     {
         if(_billTypeService.GetBillTypesByName(model.TypeName).Count()>0)
         {
             ModelState.AddModelError("", "Введенное наименование уже существует, введите другое.");
             return View(model);
         }
         entity.TypeName = model.TypeName;
         _billTypeService.SaveBillType();
         return RedirectToAction("Index");
     }
     return View(model);
 }
 public ActionResult Create()
 {
     var model = new BillTypeFormModel();
     return View(model);
 }