public IHttpActionResult Patch(int id, [FromBody] string content, [FromBody] string title, [FromBody] List <string> tags) { var task = context.Task.FirstOrDefault(x => x.Id == id); if (task != null) { task.Title = title; task.Tags = CreateTagList.TagsList(tags); task.Content = content; task.LastModified = DateTime.Now.Date; context.SaveChanges(); } return(Ok(task)); }
public ActionResult Edit(int id, string content, string title, List <string> tags) { var task = context.Task.FirstOrDefault(x => x.Id == id); List <string> temp = CreateTagList.TagsList(tags); if (task != null) { task.Title = title; task.Tags = temp; task.Content = content; task.LastModified = DateTime.Now.Date; context.SaveChanges(); } return(RedirectToAction("Index", "Home")); }
public IHttpActionResult Post([FromBody] string content, [FromBody] string title, [FromBody] List <string> tags) { var task = new PersonalTask() { Title = title, Content = content, LastModified = DateTime.Now, Tags = CreateTagList.TagsList(tags) }; context.Task.Add(task); context.SaveChanges(); return(Ok(task)); }
public ActionResult Create(string content, string title, List <string> tags) { List <string> temp = CreateTagList.TagsList(tags); var task = new PersonalTask() { Title = title, Content = content, LastModified = DateTime.Now, Tags = temp }; context.Task.Add(task); context.SaveChanges(); return(RedirectToAction("Index", "Home")); }