public JsonResult CreateProject(Project project) { if (string.IsNullOrEmpty(project.Name) || string.IsNullOrEmpty(project.Description)) return Json(new Project { Name = "Please supply a name for this project." }); project.ProjectStatus = (int) ProjectStatus.Open; project.OwnerId = (Guid) staticMembershipService.GetUser().ProviderUserKey; repository.SaveProject(project); return Json(project); }
public Project SaveProject(Project project) { context.Projects.Add(project); context.SaveChanges(); return project; }