public IHttpActionResult Post([FromBody]TaskModel taskModel) { var task = new TaskItem(); task.CreateDate = DateTime.Now; task.UpdateDate = task.CreateDate; task.IsComplete = taskModel.IsComplete; task.Name = taskModel.Name; task.Notes = taskModel.Notes; task.Order = taskModel.Order; task.Priority = taskModel.Priority; this._context.Tasks.Add(task); this._context.SaveChanges(); var link = "/api/task/" + task.ID; return Ok(link); }
public TaskModel Create(TaskItem task) { var respone = new TaskModel { IsComplete = task.IsComplete, Name = task.Name, Notes = task.Notes, Order = task.Order, Priority = task.Priority, TaskID = task.ID, CreateDate = task.CreateDate }; return respone; }