示例#1
0
        public async Task <IActionResult> Edit(SkillModifyInputModel modifiedModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(modifiedModel));
            }

            try
            {
                await _skillsService.EditAsync(modifiedModel);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"An exception occured during skill record UPDATE operation for skillId: {modifiedModel.Id}.");
                return(RedirectToAction("Error", "Home"));
            }

            return(RedirectToAction("Index", "Home"));
        }
示例#2
0
        public async Task <IActionResult> Delete(SkillModifyInputModel modifiedModel, string onSubmitAction)
        {
            if (onSubmitAction.IsNullOrEmpty() || onSubmitAction == "Cancel")
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (!ModelState.IsValid)
            {
                return(View(modifiedModel));
            }

            try
            {
                await _skillsService.DeleteAsync(modifiedModel.Id);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"An exception occured during skill record DELETE operation for skillId: {modifiedModel.Id}.");
                return(RedirectToAction("Error", "Home"));
            }

            return(RedirectToAction("Index", "Home"));
        }