public async Task <IActionResult> CreateCell()
        {
            CreateCellViewModel createCell = new CreateCellViewModel();

            createCell.Storages = await _storageRepository.GetStoragesAsync();

            createCell.Standarts = await _standartRepository.GetStandartsCellModelAsync();

            return(View(createCell));
        }
        public async Task <IActionResult> GetCellInfo(CreateCellViewModel updateCell)
        {
            if (!ModelState.IsValid)
            {
                return(View(updateCell));
            }
            var result = await _storageRepository.UpdateCellViewModelAsync(updateCell);

            if (result != null)
            {
                ModelState.AddModelError("", result);
            }
            return(View(updateCell));
        }
        public async Task <IActionResult> CreateCell(CreateCellViewModel createCell)
        {
            if (!ModelState.IsValid)
            {
                return(View(createCell));
            }
            var result = await _storageRepository.CreateCell(createCell);

            if (result != null)
            {
                ModelState.AddModelError("", result);
                return(View(createCell));
            }
            return(RedirectToAction(nameof(CreateCell)));
        }
示例#4
0
        public async Task <string> CreateCell(CreateCellViewModel createCell)
        {
            Cell cell = new Cell()
            {
                Width      = createCell.Width,
                Height     = createCell.Height,
                Length     = createCell.Length,
                Capacity   = createCell.Capacity,
                StandardId = createCell.StandardId,
                StorageId  = createCell.StorageId
            };

            await dataContext.Cells.AddAsync(cell);

            return(await SaveAsync());
        }
示例#5
0
        public async Task <string> UpdateCellViewModelAsync(CreateCellViewModel createCell)
        {
            Cell newCell = new Cell()
            {
                CellId     = createCell.CellId,
                Width      = createCell.Width,
                Height     = createCell.Height,
                Length     = createCell.Length,
                Capacity   = createCell.Capacity,
                StandardId = createCell.StandardId,
                StorageId  = createCell.StorageId,
                Status     = createCell.Status
            };

            dataContext.Cells.Update(newCell);
            var result = await SaveAsync();

            return(result);
        }
示例#6
0
        public async Task <CreateCellViewModel> GetCellViewModelAsync(int id)
        {
            var cell = await GetCellAsync(id);

            if (cell == null)
            {
                return(null);
            }
            CreateCellViewModel createCell = new CreateCellViewModel()
            {
                CellId     = cell.CellId,
                Status     = cell.Status,
                Capacity   = cell.Capacity,
                Width      = cell.Width,
                Height     = cell.Height,
                Length     = cell.Length,
                StorageId  = cell.StorageId,
                StandardId = cell.StandardId
            };

            createCell.Storages = await GetStoragesAsync();

            return(createCell);
        }