public void delete(long Designation_id)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    var DesignationCategory = _DesignationRepository.getById(Designation_id);

                    if (DesignationCategory == null)
                    {
                        throw new ItemNotFoundException($"Designation category with id {Designation_id} doesnot exist.");
                    }

                    _DesignationRepository.delete(DesignationCategory);
                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public IActionResult edit(long Designation_id)
        {
            try
            {
                var            designation = _designationRepository.getById(Designation_id);
                DesignationDto dto         = _mapper.Map <DesignationDto>(designation);

                RouteData.Values.Remove("Designation_id");
                return(View(dto));
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
                return(RedirectToAction("index"));
            }
        }