public object Update(object entity) { PutUpdateToDoDataRequest request = (PutUpdateToDoDataRequest)entity; ToDoData todoData = request.ToDoData; bool result = false; if (todoData != null) { METoDo meToDo = new METoDo(this.UserId, todoData.CreatedOn) { Status = (Status)todoData.StatusId, Priority = (Priority)todoData.PriorityId, Description = todoData.Description, Title = todoData.Title, LoweredTitle = todoData.Title != null?todoData.Title.ToLower() : null, DueDate = todoData.DueDate, StartTime = todoData.StartTime, Duration = todoData.Duration, ClosedDate = todoData.ClosedDate }; } result = true; return(result); }
public object Insert(object newEntity) { PutInsertToDoDataRequest request = (PutInsertToDoDataRequest)newEntity; ToDoData todoData = request.ToDoData; string id = null; METoDo meToDo = null; try { if (todoData != null) { meToDo = new METoDo(this.UserId, todoData.CreatedOn) { Id = ObjectId.Parse("532b6320a381168abe000877"), Status = (Status)todoData.StatusId, Priority = (Priority)todoData.PriorityId, Description = todoData.Description, Title = todoData.Title, LoweredTitle = todoData.Title != null?todoData.Title.ToLower() : null, DueDate = todoData.DueDate, StartTime = meToDo.StartTime, Duration = meToDo.Duration, DeleteFlag = false, AssignedToId = ObjectId.Parse(todoData.AssignedToId), SourceId = ObjectId.Parse(todoData.SourceId), ClosedDate = todoData.ClosedDate, LastUpdatedOn = todoData.UpdatedOn }; } return(meToDo.Id.ToString()); } catch (Exception) { throw; } }