public IHttpActionResult Post(Project project) { if (project != null) { if (ModelState.IsValid) { if (project.ReleaseTime == null) { project.ReleaseTime = DateTime.Now; } if (project.DeadlineTime == null) { project.DeadlineTime = DateTime.Now.AddDays(30); } Project createdProject = projectDal.CreateProject(project); return(CreatedAtRoute("DefaultApi", new { id = createdProject.Id }, createdProject)); } else { return(BadRequest(ModelState)); } } else { return(BadRequest("Project can not be Null.")); } }
public ActionResult Publish(Project project) { project.OwnerId = Convert.ToInt32(Session["userID"]); project.ReleaseTime = DateTime.Now; project.StateId = new State().Id = 1; _projectDal.CreateProject(project); TempData.Add("message", String.Format("Proje başarılı bir şekilde yayımlandı.")); return(RedirectToAction("index", "Home")); }