Example #1
0
        public ListDto AddResource(ListManipulationDto resource, Guid id)
        {
            var createdList = new List()
            {
                Id      = Guid.NewGuid(),
                Name    = resource.Name,
                UserId  = id,
                Created = DateTimeOffset.UtcNow
            };

            _context.Add(createdList);

            return(new ListDto()
            {
                Id = createdList.Id,
                Name = createdList.Name,
                AuthorId = createdList.UserId,
                Author = _context.Users.Where(u => u.Id == createdList.UserId).Select(name => name.FirstName + " " + name.LastName).FirstOrDefault(),
                ItemsLeftToComplete = 0,
                Items = new List <ItemDto>()
            });
        }
Example #2
0
 public void ExecuteUpdateResource(List resource, ListManipulationDto dto)
 {
     _context.UpdateResource(resource, dto);
 }
Example #3
0
 public void UpdateResource(List resource, ListManipulationDto dto)
 {
     resource.Name = string.IsNullOrWhiteSpace(dto.Name) ? resource.Name : dto.Name;
 }
Example #4
0
 public ListDto ExecuteAddResource(ListManipulationDto resource, Guid id)
 {
     return(_context.AddResource(resource, id));
 }