public ActionResult Create([Bind(Include = "Id,CurrentMedication,AnimalAllergies")] AnimalHistory animalHistory) { if (ModelState.IsValid) { db.AnimalHistory.Add(animalHistory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(animalHistory)); }
public ActionResult Create([Bind(Include = "Id,AnimalId,MicrochipNumber,EartagNumber")] ChipIdentification chipIdentification) { if (ModelState.IsValid) { db.ChipIdentification.Add(chipIdentification); db.SaveChanges(); return(RedirectToAction("Create", "Insurances")); } return(View(chipIdentification)); }
public ActionResult Create([Bind(Include = "AnimalId,OwnerId,AnimalName,AnimalSpecies,AnimalBreed,AnimalAge,AnimalEstimatedWeight,AnimalDescription")] AnimalInfo animalInfo) { if (ModelState.IsValid) { db.AnimalInfo.Add(animalInfo); db.SaveChanges(); return(RedirectToAction("Create", "AnimalBehaviors")); } return(View(animalInfo)); }
public ActionResult Create([Bind(Include = "Id,MovementStatus,Description")] TrackingOperations trackingOperations) { if (ModelState.IsValid) { db.TrackingOperations.Add(trackingOperations); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trackingOperations)); }
public ActionResult Create([Bind(Include = "Id,OwnerId,FirstName,LastName,PetRelation,PhoneNumber")] AdditionalContact additionalContact) { if (ModelState.IsValid) { db.AdditionalContact.Add(additionalContact); db.SaveChanges(); return(RedirectToAction("Create", "AdditionalPetInfoes")); } return(View(additionalContact)); }
public ActionResult Create([Bind(Include = "Id,JobName,Description")] ShelterOperations shelterOperations) { if (ModelState.IsValid) { db.ShelterOperations.Add(shelterOperations); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shelterOperations)); }
public ActionResult Create([Bind(Include = "Id,AnimalId,Year,Vaccination,Reason")] MedicalHistory medicalHistory) { if (ModelState.IsValid) { db.MedicalHistory.Add(medicalHistory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(medicalHistory)); }
public ActionResult Create([Bind(Include = "Id,AnimalId,AggressionComments")] AnimalBehavior animalBehavior) { if (ModelState.IsValid) { db.AnimalBehavior.Add(animalBehavior); db.SaveChanges(); return(RedirectToAction("Create", "AnimalHistories")); } return(View(animalBehavior)); }
public ActionResult Create([Bind(Include = "Id,AnimalId,InsuranceName")] Insurance insurance) { if (ModelState.IsValid) { db.Insurance.Add(insurance); db.SaveChanges(); return(RedirectToAction("Create", "SecondaryContacts")); } return(View(insurance)); }
public ActionResult Create([Bind(Include = "Id,FacilityId,LocationKind,LocationName,Address,City,State,ZipCode,PhoneNumber,Directions,OperationalHours")] FacilityInfo facilityInfo) { if (ModelState.IsValid) { db.FacilityInfo.Add(facilityInfo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(facilityInfo)); }
public ActionResult Create([Bind(Include = "Id,AnimalId,Belongings,Comment")] AdditionalPetInfo additionalPetInfo) { if (ModelState.IsValid) { db.AdditonalPetInfo.Add(additionalPetInfo); db.SaveChanges(); return(RedirectToAction("Index", "AnimalInfoes")); } return(View(additionalPetInfo)); }
public ActionResult Create([Bind(Include = "OwnerId,FirstName,LastName,HomeAddress,City,State,County,ZipCode,HomePhone,CellPhone,DriversLicenseNumber,HumanEvacNumber,Email")] OwnerInfo ownerInfo) { if (ModelState.IsValid) { db.OwnerInfos.Add(ownerInfo); db.SaveChanges(); return(RedirectToAction("Create", "AnimalInfoes")); } return(View(ownerInfo)); }
public ActionResult Create([Bind(Include = "Id,OwnerId,FirstName,LastName,HomeAddress,City,State,ZipCode,HomePhone,CellPhone,DriversLicenseNumber,HumanEvacNumber")] SecondaryContact secondaryContact) { if (ModelState.IsValid) { db.SecondaryContact.Add(secondaryContact); db.SaveChanges(); return(RedirectToAction("Create", "AdditionalContacts")); } return(View(secondaryContact)); }
public async Task <IHttpActionResult> Register(DataModel.User model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = new ApplicationUser() { UserName = model.Email, Email = model.Email }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { return(GetErrorResult(result)); } using (var db = new VetContext()) { model.UserId = Guid.NewGuid(); if (model.Role == 0) { model.Role = 2; //Указываем стандартную роль при регистрации } db.Users.Add(model); //Добавляем модель юзера в собственную бд db.SaveChanges(); } return(Ok()); }
public ActionResult Register2(UserAccount userAccount) { if (ModelState.IsValid) { userAccount.UserId = Guid.NewGuid().ToString(); db.UserAccount.Add(userAccount); db.SaveChanges(); return(RedirectToAction("Login2")); } return(View()); }
public ActionResult Create(CompositeModel model) { if (ModelState.IsValid) { model.AnimalInfo.AnimalId = Guid.NewGuid().ToString(); db.AnimalInfo.Add(model.AnimalInfo); db.AnimalBehavior.Add(model.AnimalBehavior); db.AnimalHistory.Add(model.AnimalHistory); db.AdditonalPetInfo.Add(model.AdditionalPetInfo); db.ChipIdentification.Add(model.ChipIdentification); db.SaveChanges(); return(RedirectToAction("Index", "AnimalInfoes")); } throw new Exception("My Model state is not valid"); }
public ActionResult Create(FacilityCompositeModel facilitymodel) { if (ModelState.IsValid) { if (Session["UserId"] != null) { var g = Session["UserId"]; facilitymodel.FacilityInfo.FacilityId = g.ToString(); db.FacilityInfo.Add(facilitymodel.FacilityInfo); db.FacilityContact.Add(facilitymodel.FacilityContact); db.FacilitySecondaryContact.Add(facilitymodel.FacilitySecondaryContact); db.FacilityAdditionalInfo.Add(facilitymodel.FacilityAdditionalInfo); db.FacilityCapacity.Add(facilitymodel.FacilityCapacity); db.FacilityOccupancy.Add(facilitymodel.FacilityOccupancy); db.SaveChanges(); return(RedirectToAction("Details", "FacilityInfoes", new { id = facilitymodel.FacilityInfo.Id })); } } throw new Exception("My Model state is not valid"); }