public bool Create(CreditType creditTypes)
 {
     try
     {
         _creditTypesDao.CreateOrUpdate(creditTypes);
         _creditTypesDao.SaveToBase();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
        public ActionResult Create(CreditTypeViewModel viewModel)
        {
            viewModel.SubTypes = _creditTypesService.GetCreditSubTypes().Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text = x.Name
            });

            if (!ModelState.IsValid)
            {
                return PartialView("CreatePartial", viewModel);
            }

            var creditType = new CreditType()
            {
               Id = Guid.NewGuid(),
               Created = DateTime.Now,
               Name = viewModel.Name,
               Percent = viewModel.Percent,
               PayCount = viewModel.PayCount,
               StartSumPercent = viewModel.StartSumPercent,
               Info = viewModel.Info,
               Active = true,
               CreditSubTypeId = viewModel.SubTypeId
            };

            var res = _creditTypesService.Create(creditType);
            if (res)
            {
                ViewBag.Result = true;
                ViewBag.ResultMsg = "credit type created";
            }
            else
            {
                ViewBag.Result = false;
                ViewBag.ResultMsg = "credit type not created";
            }

            return PartialView("CreatePartial", viewModel);
        }