public ActionResult Edit(int id, PetProfile petProfile, HttpPostedFileBase file)
        {
            int imageid;
            PODBProjectEntities entities = new PODBProjectEntities();
            String userId = User.Identity.GetUserId();

            PostPhoto photo = new PostPhoto();
            String    path  = photo.PostPhotoPet(file);

            if (file != null)
            {
                imageid = entities.Images.Where(e => e.imagePath.Equals(path)).FirstOrDefault().imageID;
            }
            else
            {
                imageid = entities.Announcements.Where(e => e.announceId.Equals(id)).FirstOrDefault().imageID;
            }
            try
            {
                using (PODBProjectEntities edit = new PODBProjectEntities())
                {
                    petProfile.Id                = User.Identity.GetUserId();
                    petProfile.imageID           = 1;
                    edit.Entry(petProfile).State = EntityState.Modified;
                    edit.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(PetProfileModel petProfile, HttpPostedFileBase file)
        {
            PODBProjectEntities entities = new PODBProjectEntities();
            PostPhoto           photo    = new PostPhoto();
            String path = photo.PostPhotoPet(file);

            int ImageID = entities.Images.Where(e => e.imagePath.Equals(path)).FirstOrDefault().imageID;

            if (petProfile.mChipId == null)
            {
                petProfile.mChipId = "Not Microchipped";
            }
            var pet = new PetProfile
            {
                Id           = User.Identity.GetUserId(),
                imageID      = ImageID,
                petName      = petProfile.petName,
                petType      = petProfile.petType,
                petBreed     = petProfile.petBreed,
                gender       = petProfile.gender,
                mChipId      = petProfile.mChipId,
                mChipStatus  = petProfile.mChipStatus,
                nueterStatus = petProfile.nueterStatus
            };

            entities.PetProfiles.Add(pet);
            try
            {
                entities.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var entityValidationErrors in ex.EntityValidationErrors)
                {
                    foreach (var validationError in entityValidationErrors.ValidationErrors)
                    {
                        Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }