Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Create([Bind("Id,Name")] PartnerTypeModel partnerType)
 {
     if (ModelState.IsValid)
     {
         partnerType = _partnerTypeFactory.CraetePartnerType(partnerType);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(partnerType));
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        public PartnerTypeModel CraetePartnerType(PartnerTypeModel model)
        {
            var partner = _mapper.Map <PartnerTypeModel, PartnerType>(model);

            return(_mapper.Map <PartnerType, PartnerTypeModel>(_partnerTypeService.Create(partner)));
        }