Exemplo n.º 1
0
        public IHttpActionResult PutPetUpdateMaster(PetUpdate petupdate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                PetUpdate objEmp = new PetUpdate();
                objEmp = objEntity.PetUpdates.Find(petupdate.PetUpdateID);
                if (objEmp != null)
                {
                    objEmp.UpdateDate      = petupdate.UpdateDate;
                    objEmp.NameDescription = petupdate.NameDescription;
                    objEmp.FeedingStatus   = petupdate.FeedingStatus;
                    objEmp.WalkingStatus   = petupdate.WalkingStatus;
                    objEmp.GroomedStatus   = petupdate.GroomedStatus;
                }
                int i = this.objEntity.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
            return(Ok(petupdate));
        }
Exemplo n.º 2
0
        public ActionResult Update(int id)
        {
            Pet            selectedpet = db.Pets.SqlQuery("select * from pets where petid = @id", new SqlParameter("@id", id)).FirstOrDefault();
            List <Species> species     = db.Species.SqlQuery("select * from Species").ToList();
            PetUpdate      petUpdate   = new PetUpdate();

            petUpdate.Pet     = selectedpet;
            petUpdate.Species = species;
            return(View(petUpdate));
        }
Exemplo n.º 3
0
        public IHttpActionResult PostPetUpdate(PetUpdate data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                objEntity.PetUpdates.Add(data);
                objEntity.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }



            return(Ok(data));
        }
Exemplo n.º 4
0
        public IHttpActionResult GetPetUpdateById(string petupdateId)
        {
            PetUpdate objEmp = new PetUpdate();

            objEntity.Configuration.ProxyCreationEnabled = false;
            int ID = Convert.ToInt32(petupdateId);

            try
            {
                objEmp = objEntity.PetUpdates.Find(ID);
                if (objEmp == null)
                {
                    return(NotFound());
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(Ok(objEmp));
        }