Exemplo n.º 1
0
        public async Task <IActionResult> DeleteProfession(Guid professionId)
        {
            var professionEntity = await _professionRepository.GetProfessionAsync(professionId);

            if (professionEntity == null)
            {
                return(NotFound());
            }

            _professionRepository.DeleteProfession(professionEntity);
            await _professionRepository.SaveAsync();

            return(NoContent());
        }
Exemplo n.º 2
0
        public List <ProfessionModel> DeleteProfession(ProfessionModel model)
        {
            List <ProfessionModel> professions = null;

            try
            {
                _professionRepository.DeleteProfession(model.ID);
                professions = GetAllProfessionList(model);
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "Profession", message);
                throw new Exception(ex.Message);
            }
            return(professions);
        }