Ejemplo n.º 1
0
        public async Task Update(ToDoViewModel model)
        {
            try
            {
                ToDoEntity objToDoEntity = new ToDoEntity
                {
                    Id            = Convert.ToInt32(model.Id),
                    Name          = model.Name,
                    Description   = model.Description,
                    IsCompleted   = model.IsCompleted,
                    CompletedDate = model.IsCompleted ? DateTime.Now : (DateTime?)null,
                    Priority      = Convert.ToInt32(model.Priority)
                };

                await _ITableToDo.Update <ToDoEntity>(objToDoEntity, Convert.ToInt32(model.Id));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public async Task Add(ToDoViewModel model)
        {
            try
            {
                ToDoEntity objToDoEntity = new ToDoEntity
                {
                    Id            = Convert.ToInt32(model.Id),
                    Name          = model.Name,
                    Description   = model.Description,
                    AddedDate     = DateTime.Now,
                    IsCompleted   = false,
                    CompletedDate = null,
                    Priority      = Convert.ToInt32(model.Priority)
                };

                await _ITableToDo.Add <ToDoEntity>(objToDoEntity);
            }catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }