Exemplo n.º 1
0
        public async Task <CassetteProperties> UpdateAsync(CassetteProperties request)
        {
            int id;

            if (int.TryParse(request.Num, out id))
            {
                int[] realContainersId = new int[] { id };
                var   statuses         = await _realContainerRepo.GetStatusesAsync();

                int?realContainerStatusId = statuses.ToList().Find(s => s.Name == request.Status)?.IdType;

                if (realContainerStatusId.HasValue)
                {
                    await _realContainerRepo.UpdateStatusAsync(realContainersId, realContainerStatusId.Value, false);
                }

                await _realContainerRepo.SetPropertiesAsync(realContainersId, request.AtRemove, request.AtCheck);

                var cas = await _realContainerRepo.GetAsync(realContainersId);

                return(_mapper.Map <RealContainer, CassetteProperties>(cas?.FirstOrDefault()));
            }

            return(null);
        }
 public async Task <List <RealContainerStatus> > GetRealContainerStatusesAsync()
 {
     return(await _realcontainerRepository.GetStatusesAsync());
 }