public ActionResult Details(int id) { IUrgency urgency = _service.GetUrgencyById(id); var urgenc = Mapper.Map <IUrgency, UrgencyModel>(urgency); return(View(urgenc)); }
public ActionResult Create(IncidentPriorityModel incidentPriorytyModel) { try { IIncidentPriority _incidentPriority = Mapper.Map <IncidentPriorityModel, IIncidentPriority>(incidentPriorytyModel, opt => opt.ConfigureMap() .ForMember(dest => dest.ResolutionTime, m => m.MapFrom(src => src.ResolutionTime)) .ForMember(dest => dest.ResponceTime, m => m.MapFrom(src => src.ResponceTime)) .ForMember(dest => dest.Description, m => m.MapFrom(src => src.Description)) .ForMember(dest => dest.Title, m => m.MapFrom(src => src.Title)) .ForMember(dest => dest.IncidentImpact, m => m.Ignore()) .ForMember(dest => dest.IncidentUrgency, m => m.Ignore())); _incidentPriority.IncidentImpact = _service.GetImpactById(incidentPriorytyModel.ImpactId); _incidentPriority.IncidentUrgency = _service.GetUrgencyById(incidentPriorytyModel.UrgencyId); _service.CreateIncidentPriority(_incidentPriority); return(RedirectToAction("Index")); } catch { return(View()); } }