コード例 #1
0
        public async Task UpdateSpecieCategory(SpecieCategoryDto input)
        {
            var category = _specieCategoryRepository.FirstOrDefault(input.Id);

            category.Description = input.Description;
            category.Name        = input.Name;
            category.Amount      = input.Amount;

            await _specieCategoryRepository.UpdateAsync(category);
        }
コード例 #2
0
        public async Task DeleteSpecieCategoryAsync(SpecieCategoryDto input)
        {
            var category = _specieCategoryRepository.FirstOrDefault(input.Id);

            if (category == null)
            {
                throw new UserFriendlyException("Category not Found!");
            }

            await _specieCategoryRepository.DeleteAsync(category);
        }
コード例 #3
0
        public async Task <ActionResult> Edit(int id, SpecieCategoryDto input)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    await _specieCategoryAppService.UpdateSpecieCategory(input);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(input));
                }
            }
            catch
            {
                return(View(input));
            }
        }