示例#1
0
        public IActionResult Post([FromBody] TaskLogAPI item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            TaskLog TaskLog = TaskLogAPI.To(item);

            try
            {
                TaskLog = new TaskLogBF(DB).Create(TaskLog);

                return(CreatedAtRoute(
                           "TaskLogRoute",
                           new
                {
                    controller = "TaskLog",
                    id = TaskLog.ID
                },
                           TaskLogAPI.From(TaskLog)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
示例#2
0
        public IActionResult Put(long id, [FromBody] TaskLogAPI item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            try
            {
                TaskLog updateItem = new TaskLogBF(DB).Update(TaskLogAPI.To(item));

                return(new ObjectResult(TaskLogAPI.From(updateItem)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }