public static SponsorDataModel ToModel(this SponsorData SponsorData, IPictureService _pictureService) { if (SponsorData == null) { return(new SponsorDataModel()); } var model = new SponsorDataModel() { Id = SponsorData.Id, BattleType = SponsorData.BattleType, BattleId = SponsorData.BattleId, SponsorCustomerId = SponsorData.SponsorCustomerId, PictureId = SponsorData.PictureId, DisplayName = SponsorData.DisplayName, TargetUrl = SponsorData.TargetUrl, DisplayOrder = SponsorData.DisplayOrder }; if (SponsorData.PictureId > 0) { model.PictureUrl = _pictureService.GetPictureUrl(model.PictureId); } return(model); }
public ActionResult Create(SponsorDataCreateVM objSponCrtVm, int[] SelChkEsmIds) { try { using (var unitOfWork = new UnitWork1(new EAMSContext())) { if (SelChkEsmIds != null) { objSponCrtVm.iESMOffrDetails = new List <ESMOfficersDetail>(); foreach (var esmId in SelChkEsmIds) { var esmIdToAdd = unitOfWork.ESMDetails.SingleOrDefault(x => x.EsmId == esmId); objSponCrtVm.iESMOffrDetails.Add(esmIdToAdd); } } var config = new MapperConfiguration(cfg => { cfg.CreateMap <SponsorDataCreateVM, SponsorData>(); }); IMapper mapper = config.CreateMapper(); SponsorData CreateDto = mapper.Map <SponsorDataCreateVM, SponsorData>(objSponCrtVm); unitOfWork.SponsorDatas.Add(CreateDto); //ViewData["SelectedOrg"] = objSponCrtVm.ComapnyId; //ViewData["Vacancy"] = objSponCrtVm.VacancyId; unitOfWork.Complete(); return(RedirectToAction("Index")); } } catch { return(View()); } }
public void SaveSponsorData(SponsorData SponsorData) { if (SponsorData.Id == 0) { _sponsorDataRepository.Insert(SponsorData); } else { _sponsorDataRepository.Update(SponsorData); } }
public void OpenSponsorDataBtn() { SponsorData newWindow = new SponsorData(); newWindow.ShowDialog(); }
public SponsorDataViewModel(SponsorData window) { Window = window; }