Ejemplo n.º 1
0
        public IActionResult UpdateQuantity(OfficeRepository officeRepository)
        {
            bool isExist = _offDal.OfficeRepositories.Where(i => i.ProductID == officeRepository.ProductID).Any();

            if (isExist)
            {
                int officeRepoID = _offDal.OfficeRepositories.Where(i => i.ProductID == officeRepository.ProductID).Select(o => o.ID).Single();
                officeRepository.ID = officeRepoID;
                _offDal.UpdateOfficeRepository(officeRepository);
            }
            else
            {
                officeRepository.ID = 0;
                _offDal.AddOfficeRepository(officeRepository);
            }
            return(RedirectToAction(nameof(List)));
        }