public PartnerTypeModel UpdatePartnerType(PartnerTypeModel partnerType) { var dPartnerType = _partnerTypeService.GetPartnerTypes().FirstOrDefault(x => x.Id == partnerType.Id); dPartnerType.Name = partnerType.Name; var ret = _partnerTypeService.Update(dPartnerType); return(_mapper.Map <PartnerType, PartnerTypeModel>(ret)); }
public async Task <IActionResult> Create([Bind("Id,Name")] PartnerTypeModel partnerType) { if (ModelState.IsValid) { partnerType = _partnerTypeFactory.CraetePartnerType(partnerType); return(RedirectToAction(nameof(Index))); } return(View(partnerType)); }
public PartnerTypeModel GetPartnerType() { var result = Context.funder_profile.ToList(); PartnerTypeModel model = new PartnerTypeModel(); model.FunderCount = result.Where(x => x.PartnerType == "Funders").Count(); model.VolunteeringCount = result.Where(x => x.PartnerType == "Volunteering").Count(); model.StrategicCount = result.Where(x => x.PartnerType == "Stragetic").Count(); return(model); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] PartnerTypeModel partnerType) { if (id != partnerType.Id) { return(NotFound()); } if (ModelState.IsValid) { partnerType = _partnerTypeFactory.UpdatePartnerType(partnerType); return(RedirectToAction(nameof(Index))); } return(View(partnerType)); }
public PartnerTypeModel CraetePartnerType(PartnerTypeModel model) { var partner = _mapper.Map <PartnerTypeModel, PartnerType>(model); return(_mapper.Map <PartnerType, PartnerTypeModel>(_partnerTypeService.Create(partner))); }