Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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"));
        }