Exemplo n.º 1
0
        public IHttpActionResult PostProject(ProjectDTO project)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (ProjectExists(project.Id))
            {
                return(BadRequest("Project exists"));
            }

            return(CreatedAtRoute("GetProject", new { id = project.Id }, _service.AddProject(project, RequestContext.Principal.Identity.GetUserId())));
        }
        private async Task AddProjectHandlerAsync()
        {
            try
            {
                var project = new Project()
                {
                    Name = Name
                };
                await _projectsService.AddProject(project);

                await _navigationService.GoBack();
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 3
0
 public IActionResult AddProject([FromBody] Project project)
 {
     service.CurrentUser = CurrentUser;
     return(Ok(service.AddProject(project)));
 }