Exemple #1
0
        public static ProjectCreateModel MapProjectCreateModel(Guid organizationUid)
        {
            var model = new ProjectCreateModel();

            model.OrganizationUid = organizationUid;

            model.SetInputModelValues();

            return(model);
        }
        public async Task <IActionResult> Create(ProjectCreateModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var request  = new ProjectCreateRequest(CurrentUser.Id, model.OrganizationUid, model.Name, model.Url, model.Description);
            var response = await _projectService.CreateProject(request);

            if (response.Status.IsNotSuccess)
            {
                model.MapMessages(response);
                model.SetInputModelValues();
                return(View(model));
            }

            CurrentUser.IsActionSucceed = true;
            return(Redirect($"/Project/Detail/{response.Item.Uid}"));
        }