예제 #1
0
 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;
 }
예제 #2
0
 public ActionResult DeleteApp(ApplicationModel model)
 {
     if (ApplicationHelper.DeleteById(model.IdApplication))
     {
         return RedirectToAction("ListApps");
     }
     else
     {
         ModelState.AddModelError("", "Si è Verificato un Errore.");
     }
     return View(model);
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }