Exemplo n.º 1
0
        public ActionResult Update()
        {
            var id    = this.User.Identity.GetUserId();
            var user  = adopters.GetById(id);
            var model = user.ProjectTo <AdopterProfileViewModel>().FirstOrDefault();

            model.CreatedOn = user.FirstOrDefault().CreatedOn;
            return(this.View(model));
        }
Exemplo n.º 2
0
        public ActionResult Create(CreateVolunteerFormViewModel model, string id)
        {
            if (model != null && ModelState.IsValid)
            {
                model.Other = this.sanitizeService.Sanitize(model.Other);

                var newVolunteerForm = AutoMapper.Mapper.Map <VolunteerForm>(model);

                newVolunteerForm.OrganizationId = id;

                newVolunteerForm.Organization = organizations.GetById(id).FirstOrDefault();

                newVolunteerForm.UserId = this.User.Identity.GetUserId();

                newVolunteerForm.User = adopters.GetById(newVolunteerForm.UserId).FirstOrDefault();

                this.volunteers.AddNew(newVolunteerForm);

                return(this.RedirectToAction("Index", "Home", new { area = "" }));
            }
            else
            {
                return(this.View(model));
            }
        }
Exemplo n.º 3
0
        public ActionResult Create(CreateAdoptionFormViewModel model, int id)
        {
            if (model != null && ModelState.IsValid)
            {
                model.AnimalsDescription = this.sanitizeService.Sanitize(model.AnimalsDescription);

                model.ExpirienceWithAnimals = this.sanitizeService.Sanitize(model.ExpirienceWithAnimals);

                model.KidsDescription = this.sanitizeService.Sanitize(model.KidsDescription);

                model.Address = this.sanitizeService.Sanitize(model.Address);

                model.AttitudeAboutCastration = this.sanitizeService.Sanitize(model.AttitudeAboutCastration);

                var newAdoptionForm = AutoMapper.Mapper.Map <AdoptionForm>(model);

                newAdoptionForm.AnimalId = id;

                newAdoptionForm.Animal = animals.GetById(id).FirstOrDefault();

                newAdoptionForm.UserId = this.User.Identity.GetUserId();

                newAdoptionForm.User = adopters.GetById(newAdoptionForm.UserId).FirstOrDefault();

                this.adoptionForms.AddNew(newAdoptionForm);

                return(this.RedirectToAction("Index", "Home", new { area = "" }));
            }
            else
            {
                return(this.View(model));
            }
        }
Exemplo n.º 4
0
        public ActionResult Details(string id)
        {
            var adopter = adopters.GetById(id)
                          .ProjectTo <AdopterDetailView>()
                          .FirstOrDefault();

            return(View(adopter));
        }