public ActionResult Create(CoolAppModel model) { CoolApp coolApp = _coolAppService.GetById(model.Id); if (coolApp != null) { model.Errors.Add(_languageService.GetLocaleString("CoolApp Already Exists")); return(Json(model)); } if (_coolAppService.GetAll().Where(k => k.Id == model.Id && k.CoolComId == model.CompanyId).Count() > 0) { model.Errors.Add(_languageService.GetLocaleString("CoolApp Already Exists")); return(Json(model)); } if (ModelState.IsValid) { coolApp = new CoolApp(); coolApp.CoolComId = model.CompanyId; coolApp.CoolCompanyId = model.CoolCompanyId; coolApp.AppCode = model.AppCode; _coolAppService.Insert(coolApp); model.SuccessMessage = _languageService.GetLocaleString("CoolApp Created"); } else { model.Errors.Add("Check fields for editing"); } return(Json(model)); }
private CoolAppModel PrepareCoolAppModel(CoolAppModel model, CoolApp coolApp, bool fillAvailableCompanies = false) { model.Id = coolApp.Id; model.AppCode = coolApp.AppCode; model.CompanyId = coolApp.CoolComId; model.CoolCompanyId = coolApp.CoolCompanyId; model.Image = "<span class=\"avatar avatar-online\"><img src=\"" + _erpManagerSettings.AppPicturePath + coolApp.Id + "\"/></span>"; if (fillAvailableCompanies) { model.AvailableCompanies = _coolComService.GetAll().Select(k => new SelectListItem { Text = k.Id, Value = k.Id }).ToList(); } return(model); }
public void Insert(CoolApp coolApp) { coolApp.CreatedDate = DateTime.Now; _coolAppData.Add(coolApp); }
public void Update(CoolApp coolApp) { _coolAppData.Update(coolApp); }