public void Create(TaskList entityToCreate) { var taskList = entityToCreate.MapToTaskListEntity(); var taskListShare = new TaskListShareEntity(entityToCreate.RowKey, entityToCreate.Owner.RowKey); TaskLists.Add(taskList); TaskListShares.Add(taskListShare); }
/// <summary> /// Creates a new TaskList. /// </summary> /// <param name="entityToCreate">TaskList domain object with the properties to map to an TaskLists table entity</param> public void Create(TaskList entityToCreate) { entityToCreate.PartitionKey = entityToCreate.Owner.RowKey; entityToCreate.RowKey = ShortGuid.NewGuid(); var taskListEntity = entityToCreate.MapToTaskListEntity(); _unitOfWork.Create(taskListEntity, "TaskLists"); // the User that creates the new TaskList is automatically add in the TaskList Shares list. var sharePartitionKey = string.Format("{0}+{1}", entityToCreate.PartitionKey, entityToCreate.RowKey); var taskListShare = new TaskListShareEntity(sharePartitionKey, entityToCreate.Owner.RowKey); _unitOfWork.Create(taskListShare, "TaskListShares"); }
public void Update(TaskList entityToUpdate) { var taskList = entityToUpdate.MapToTaskListEntity(); var taskListToRemove = TaskLists.First(n => n.PartitionKey == taskList.PartitionKey && n.RowKey == taskList.RowKey); TaskLists.Remove(taskListToRemove); TaskLists.Add(taskList); }
/// <summary> /// Updates an entity in the TaskLists Azure Table. /// </summary> /// <param name="entityToUpdate">TaskList domain object with the properties to update an existing TaskLists table entity</param> public void Update(TaskList entityToUpdate) { _unitOfWork.Update("TaskLists", entityToUpdate.MapToTaskListEntity()); }