Ejemplo n.º 1
0
        public IHttpActionResult UpdatePartCategory(PartCategoryMaster partCategoryMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                //  var objGM = new GaugeTypeMaster();
                var objGM = new PartCategoryMaster();
                objGM = objEntity.PartCategoryMasters.Find(partCategoryMaster.ID);

                if (objGM != null)
                {
                    objGM.ID          = partCategoryMaster.ID;
                    objGM.PartDetails = partCategoryMaster.PartDetails;
                }
                int i = this.objEntity.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Ok(partCategoryMaster));
        }
Ejemplo n.º 2
0
        public IHttpActionResult DeletePartCategory(int id)
        {
            PartCategoryMaster master = objEntity.PartCategoryMasters.Find(id);

            if (master == null)
            {
                return(NotFound());
            }
            objEntity.PartCategoryMasters.Remove(master);
            objEntity.SaveChanges();
            return(Ok(master));
        }
Ejemplo n.º 3
0
 public IHttpActionResult InsertPartCategory(PartCategoryMaster partCategoryMaster)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         objEntity.PartCategoryMasters.Add(partCategoryMaster);
         objEntity.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(Ok(partCategoryMaster));
 }