Esempio n. 1
0
        public async Task <IActionResult> ProjectEditPost(int id, ProjectWorkModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _crudService.Edit(id, model, Token, ProjectService.ProjectEntity);

                AddMessageToModel(model, result.Message, !result.Success);
            }
            else
            {
                AddModelStateErrors(model);
            }

            return(View("Edit", model));
        }
Esempio n. 2
0
        public async Task <IActionResult> ProjectAddPost(ProjectWorkModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _crudService.Create(model, Token, ProjectService.ProjectEntity);

                AddMessageToModel(model, result.Message, !result.Success);

                if (result.Success)
                {
                    return(RedirectToActionWithId(model, "ProjectEdit", "Project", result.Id));
                }
            }
            else
            {
                AddModelStateErrors(model);
            }

            return(View("Add", model));
        }
Esempio n. 3
0
        public async Task <IActionResult> ProjectEdit(int id)
        {
            ProjectWorkModel model = new ProjectWorkModel();

            CheckTempData(model);

            var result = await _crudService.Get <ProjectModel>(id, Token, ProjectService.ProjectEntity);

            if (result.Success)
            {
                model.Id          = id;
                model.Name        = result.Value.Name;
                model.Description = result.Value.Description;
            }
            else
            {
                AddMessageToModel(model, result.Message);
            }

            return(View("Edit", model));
        }
Esempio n. 4
0
        public IActionResult ProjectAdd()
        {
            ProjectWorkModel model = new ProjectWorkModel();

            return(View("Add", model));
        }