public ActionResult Create() { IncidentPriorityModel _model = new IncidentPriorityModel(); _model.ImpactsList = _service.GetImpacts(); _model.UrgenciesList = _service.GetUrgencies(); return(View(_model)); }
public ActionResult Edit(int id, IncidentPriorityModel incidentPriorytyModel) { try { IIncidentPriority _incidentPriority = _service.GetIncidentPriorityById(id); _incidentPriority.Title = incidentPriorytyModel.Title; _incidentPriority.Description = incidentPriorytyModel.Description; _incidentPriority.ResolutionTime = incidentPriorytyModel.ResolutionTime; _incidentPriority.ResponceTime = incidentPriorytyModel.ResponceTime; _incidentPriority.IncidentImpact = _service.GetImpactById(incidentPriorytyModel.ImpactId); _incidentPriority.IncidentUrgency = _service.GetUrgencyById(incidentPriorytyModel.UrgencyId); _service.UpdateIncidentPriority(_incidentPriority); return(RedirectToAction("Index")); } catch { return(View()); } }
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()); } }