public IActionResult AddProject(InputProjectModel inputProjectModel) { context.Projects.Add(new Project() { Title = inputProjectModel.Name, }); context.SaveChanges(); return(StatusCode((int)HttpStatusCode.OK)); }
public IActionResult AddProject(InputProjectModel inputProjectModel) { context.Projects.Add(new Project() { Title = inputProjectModel.Name, ClientSector = inputProjectModel.ClientSector, Technologies = inputProjectModel.Technologies, StartDate = inputProjectModel.StartDate, EndDate = inputProjectModel.EndDate, }); context.SaveChanges(); return(StatusCode((int)HttpStatusCode.OK)); }
public IActionResult AddProject([FromBody] InputProjectModel inputProjectModel) { var xx = ModelState.IsValid; context.Projects.Add(new Project() { Name = inputProjectModel.Name, Title = inputProjectModel.Title, ClientSector = inputProjectModel.ClientSector, StartDate = inputProjectModel.StartDate, EndDate = inputProjectModel.EndDate, }); context.SaveChanges(); return(StatusCode((int)HttpStatusCode.OK)); }
public IActionResult EditProject(InputProjectModel inputProjectModel) { if (inputProjectModel == null) { return(new StatusCodeResult((int)HttpStatusCode.BadRequest)); } var project = context.Projects.FirstOrDefault(x => x.Id == inputProjectModel.Id); if (project == null) { return(new StatusCodeResult((int)HttpStatusCode.NotFound)); } project.Title = inputProjectModel.Name; project.ClientSector = inputProjectModel.ClientSector; project.StartDate = inputProjectModel.StartDate; project.EndDate = inputProjectModel.EndDate; context.SaveChanges(); return(StatusCode((int)HttpStatusCode.OK)); }