public ActionResult Add(models.ExpositionWinner winner, string idExposition, int idMember) { if (ModelState.IsValid && idExposition != null && idMember != 0) { models.Exposition oldExp = Mapper.Map<models.Exposition>(ServiceFactory.Instance.ExpositionService.GetById(Convert.ToInt32(idExposition))); List<models.ExpositionWinner> res = new List<models.ExpositionWinner>(); models.ExpositionMember member = oldExp.GetMembers.FirstOrDefault(item => item.IdExposition == Convert.ToInt32(idExposition) && item.IdDog == idMember); ViewData["allMember"] = oldExp.GetDogsExpositionMembers; List<models.Avard> allAvard = Mapper.Map<List<models.Avard>>(ServiceFactory.Instance.AvardsService.GetAll()); ViewData["allAvard"] = allAvard; res = member.GetExpositionWinner.Where(item => item.IdExpositionMember == member.Id).ToList(); if (res.Count != 0) { ViewData["SecondVavue"] = "SecondVavue"; return View(); } if (oldExp.GetDogsExpositionMembers.Any(t => t.Id == winner.IdExpositionMember)) { ViewData["NotMember"] = "NullMember"; return View(); } winner.IdExpositionMember = member.Id; ServiceFactory.Instance.ExpositionWinnersService.Add(winner.ToDomainModel()); return RedirectToAction("GetAllDogs", new { idExp = Convert.ToInt32(idExposition) }); } return View(); }
public ActionResult Edit(models.Exposition exp) { if (ModelState.IsValid) { ServiceFactory.Instance.ExpositionService.Edit(exp.ToDomainModel()); } return View(); }
public ActionResult Add(models.DogType dogType) { if (ModelState.IsValid) { ServiceFactory.Instance.DogTypesService.Add(dogType.ToDomainModel()); } return PartialView(dogType); }
public ActionResult Edit(models.DogType dog) { if (ModelState.IsValid) { ServiceFactory.Instance.DogTypesService.Edit(dog.ToDomainModel()); } return RedirectToAction("Index"); }
public ActionResult Edit(models.Avard avard) { if (ModelState.IsValid) { ServiceFactory.Instance.AvardsService.Edit(avard.ToDomainModel()); } return RedirectToAction("Index"); }
public ActionResult Add(models.Exposition exp) { if (ModelState.IsValid) { ServiceFactory.Instance.ExpositionService.Add(exp.ToDomainModel()); return PartialView(); } return PartialView(exp); }
public ActionResult Add( models.MedicalCare med, int IdDog) { if (ModelState.IsValid && IdDog != 0) { med.IdDog = IdDog; ServiceFactory.Instance.MedicalCaresService.Add(med.ToDomainModel()); } return PartialView(); }
public ActionResult Add(models.DogForSale newDogForSale) { if (ModelState.IsValid) { ViewData["allDogs"] = GetAllDog(); ServiceFactory.Instance.DogSalesService.Add(newDogForSale.ToDomainModel()); } return PartialView(); }
public ActionResult Edit(int idDog, models.MedicalCare med) { if (ModelState.IsValid && idDog != 0) { med.IdDog=idDog; ServiceFactory.Instance.MedicalCaresService.Edit(med.ToDomainModel()); } return View(); }
public ActionResult Edit(models.User newUser, string GetSexDog) { if (ModelState.IsValid) { newUser.Sex = Convert.ToInt32(GetSexDog); ServiceFactory.Instance.UserService.Edit(newUser.ToDomainModel()); } return RedirectToAction("PersonalCabinet", "Account", new { email = newUser.Email}); }
public ActionResult Edit(models.PaymentType itemPaymentType) { ViewData["allPeriod"] = GetPeriod(); if (ModelState.IsValid ) { ServiceFactory.Instance.PaymentTypesService.Edit(itemPaymentType.ToDomainModel()); return RedirectToAction("Index"); } return View(itemPaymentType); }
public ActionResult Edit(models.Vaccination edit) { if (ModelState.IsValid) { ServiceFactory.Instance.VaccinationsService.Edit(edit.ToDomainModel()); return RedirectToAction("GetItemDogAllVaccinations", new { idDog = edit.IdDog }); } return RedirectToAction("Index"); }
public ActionResult Edit(models.DogForSale dogSale) { if (ModelState.IsValid) { ViewData["allDogs"] = Mapper.Map<List<models.Dog>>(ServiceFactory.Instance.DogsService.GetAll()); ServiceFactory.Instance.DogSalesService.Edit(dogSale.ToDomainModel()); return RedirectToAction("Index"); } return View(dogSale); }
public ActionResult Add(models.Vaccination add, int idDog) { if (ModelState.IsValid && idDog != 0) { add.IdDog = idDog; ServiceFactory.Instance.VaccinationsService.Add(add.ToDomainModel()); IEnumerable<models.Dog> modelsVac = Mapper.Map<IEnumerable<models.Dog>>(ServiceFactory.Instance.DogsService.GetAll()); ViewData["allDogs"] = modelsVac; return PartialView(); } return PartialView(add); }
public ActionResult EditUserAdmin(models.User user, int[] checkedRole, string GetSexDog) { if (ModelState.IsValid && GetSexDog!=null) { user.Sex = Convert.ToInt32(GetSexDog); ServiceFactory.Instance.UserService.Edit(user.ToDomainModel()); ServiceFactory.Instance.UserService.SetUserRoles(checkedRole, user.Id); ViewData["sexDog"] = models.SexDog.GetAllSexDogs(); ViewData["AllRoles"] = Mapper.Map<IEnumerable<models.Role>>(ServiceFactory.Instance.UserService.GetAllRolesEntities()); return RedirectToAction("IsAdmin","Account"); } return View(user); }
public ActionResult Edit(models.Payment payment) { List<models.PaymentType> allPaymentType = Mapper.Map<List<models.PaymentType>>(ServiceFactory.Instance.PaymentTypesService.GetAll()); List<models.User> allUser = Mapper.Map<List<models.User>>(ServiceFactory.Instance.UserService.GetAll()); ViewData["allPaymentType"] = allPaymentType; ViewData["allUser"] = allUser; if (ModelState.IsValid) { ServiceFactory.Instance.PaymentsService.Edit(payment.ToDomainModel()); return RedirectToAction("Index"); } return View(payment); }
public ActionResult Add(models.Payment payment) { List<models.PaymentType> allPaymentType = Mapper.Map<List<models.PaymentType>>(ServiceFactory.Instance.PaymentTypesService.GetAll()); List<models.User> allUser = Mapper.Map<List<models.User>>(ServiceFactory.Instance.UserService.GetAll()); ViewData["allPaymentType"] = allPaymentType; ViewData["allUser"] = allUser; if (ModelState.IsValid) { List<models.Payment> allPayment = Mapper.Map<List<models.Payment>>(ServiceFactory.Instance.PaymentsService.GetAll()); ServiceFactory.Instance.PaymentsService.Add(payment.ToDomainModel()); } return PartialView(payment); }
public ActionResult Add(models.Avard add) { if (ModelState.IsValid) { IEnumerable<models.Avard> allAvard = Mapper.Map<IEnumerable<models.Avard>>(ServiceFactory.Instance.AvardsService.GetAll()); var avard = allAvard.FirstOrDefault(t => t.Name == add.Name); if (avard != null) { ViewData["ValueAvard"] = "notNull"; return RedirectToAction("Index"); } ServiceFactory.Instance.AvardsService.Add(add.ToDomainModel()); IEnumerable<models.Dog> modelsVac = Mapper.Map<IEnumerable<models.Dog>>(ServiceFactory.Instance.DogsService.GetAll()); return PartialView(); } return PartialView(); }
public ActionResult Add(models.Dog newDog, string GetTypeDog, string GetSexDog) { if (GetTypeDog != null && GetSexDog != null) { var user = ServiceFactory.Instance.UserService.GetByEmail(User.Identity.Name); newDog.OwnerId = user.Id; newDog.IdDogType = Convert.ToInt32(GetTypeDog); newDog.Sex = Convert.ToInt32(GetSexDog); if (ModelState.IsValid && user!=null) { ServiceFactory.Instance.UserService.AddDog(newDog.ToDomainModel(), User.Identity.Name); return RedirectToAction("GetAllDogsUSer", "Dogs"); } return View(newDog); } return View(newDog); }
public ActionResult Add(models.PaymentType itemPaymentType) { ViewData["allPeriod"] = GetPeriod(); if (ModelState.IsValid ) { IEnumerable<models.PaymentType> allPaymentType = Mapper.Map<IEnumerable<models.PaymentType>>(ServiceFactory.Instance.PaymentTypesService.GetAll()); var avard = allPaymentType.FirstOrDefault(t => t.Name == itemPaymentType.Name && t.IdPeriod == itemPaymentType.IdPeriod); if (avard != null) { ViewData["ValueAvard"] = "notNull"; return RedirectToAction("Index"); } ServiceFactory.Instance.PaymentTypesService.Add(itemPaymentType.ToDomainModel()); IEnumerable<models.Dog> modelsVac = Mapper.Map<IEnumerable<models.Dog>>(ServiceFactory.Instance.DogsService.GetAll()); return PartialView(); } return PartialView(); }
public ActionResult Registration(models.User NewUser, string GetSexDog) { if (ModelState.IsValid && !serviceFactory.UserService.IsEmailExists(NewUser.Email) && GetSexDog!=null) { NewUser.RegistrationDate = DateTime.Now; NewUser.IdRole = (int)UserRolesEnum.User; NewUser.Sex=Convert.ToInt32(GetSexDog); serviceFactory.UserService.CreateUser(NewUser.ToDomainModel()); return RedirectToAction("Login"); } return View(NewUser); }