public void delete(long Details_id) { try { using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) { var DetailCategory = _detailsRepository.getById(Details_id); if (DetailCategory == null) { throw new ItemNotFoundException($"Details category with id {Details_id} doesnot exist."); } _detailsRepository.delete(DetailCategory); tx.Complete(); } } catch (Exception) { throw; } }
public IActionResult edit(long details_id) { try { Details details = _detailsRepository.getById(details_id); DetailsModel detailsModel = _mapper.Map <DetailsModel>(details); return(View(detailsModel)); } catch (Exception ex) { AlertHelper.setMessage(this, ex.Message, messageType.error); return(RedirectToAction("index")); } }