コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        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));
        }
コード例 #10
0
        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));
        }
コード例 #11
0
        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));
        }
コード例 #12
0
        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));
        }
コード例 #13
0
        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));
        }
コード例 #14
0
ファイル: AccountController.cs プロジェクト: shubegor/Vet
        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());
        }
コード例 #15
0
ファイル: AccountController.cs プロジェクト: NEMS167/VETPRO2
 public ActionResult Register2(UserAccount userAccount)
 {
     if (ModelState.IsValid)
     {
         userAccount.UserId = Guid.NewGuid().ToString();
         db.UserAccount.Add(userAccount);
         db.SaveChanges();
         return(RedirectToAction("Login2"));
     }
     return(View());
 }
コード例 #16
0
        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");
        }
コード例 #17
0
        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");
        }