private static ApplicationModel EntityToModel(ApplicationEntity entity) { ApplicationModel result = new ApplicationModel(); result.ApplicationName = entity.ApplicationName; result.EndDate = entity.EndDate; result.IdApplication = entity.IdApplication; result.IsActive = entity.IsActive; result.StartDate = entity.StartDate; result.PublicKey = entity.PublicKey; return result; }
public ActionResult DeleteApp(ApplicationModel model) { if (ApplicationHelper.DeleteById(model.IdApplication)) { return RedirectToAction("ListApps"); } else { ModelState.AddModelError("", "Si è Verificato un Errore."); } return View(model); }
public ActionResult EditApp(ApplicationModel model) { if (ModelState.IsValid) { ApplicationEntity entity = RepositoryContext.Current.Applications.GetById(model.IdApplication); entity.ApplicationName=model.ApplicationName; entity.IsActive=model.IsActive; entity.StartDate=model.StartDate; entity.EndDate=model.EndDate; //entity.PublicKey=model.PublicKey; Do not change this is not editable RepositoryContext.Current.Applications.Save(entity); return RedirectToAction("ListApps"); } else { ModelState.AddModelError("", "Error"); } return View(model); }
public ActionResult NewApp(ApplicationModel model) { if (ModelState.IsValid) { ApplicationEntity entity = new ApplicationEntity(); entity.ApplicationName = model.ApplicationName; entity.IsActive = true; entity.StartDate = model.StartDate; entity.PublicKey = model.PublicKey; entity.PublicKey = Guid.NewGuid(); RepositoryContext.Current.Applications.Save(entity); return RedirectToAction("ListApps"); } else { ModelState.AddModelError("", "error"); } return View(model); }