public HttpResponseMessage UpdateLiveStockImagePath(LiveStock_StepMaterial liveStock_StepMaterial)
        {
            if (!ModelState.IsValid)
            {
                return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty }));
            }

            try
            {
                LiveStock_StepMaterial LiveStock_StepsMaterialData = db.LiveStock_StepMaterial.Where(a => a.Id == liveStock_StepMaterial.Id).FirstOrDefault();
                LiveStock_StepsMaterialData.ImageURL = liveStock_StepMaterial.ImageURL;

                if (liveStock_StepMaterial.UpdatedBy != null)
                {
                    LiveStock_StepsMaterialData.UpdatedBy = liveStock_StepMaterial.UpdatedBy;
                    LiveStock_StepsMaterialData.UpdatedOn = liveStock_StepMaterial.UpdatedOn;
                }

                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LiveStock_StepMaterialExists(liveStock_StepMaterial.Id))
                {
                    return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.NotFound, new { data = new { string.Empty }, success = false, error = string.Empty }));
                }
                else
                {
                    throw;
                }
            }

            return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { liveStock_StepMaterial }, success = true, error = string.Empty }));
        }
        public IHttpActionResult GetLiveStock_StepMaterial(int id)
        {
            LiveStock_StepMaterial liveStock_StepMaterial = db.LiveStock_StepMaterial.Find(id);

            if (liveStock_StepMaterial == null)
            {
                return(NotFound());
            }

            return(Ok(liveStock_StepMaterial));
        }
        public HttpResponseMessage PostLiveStock_StepMaterial(LiveStock_StepMaterial liveStock_StepMaterial)
        {
            if (!ModelState.IsValid)
            {
                return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty }));
            }

            db.LiveStock_StepMaterial.Add(liveStock_StepMaterial);
            db.SaveChanges();

            return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { id = liveStock_StepMaterial.Id }, success = true, error = string.Empty }));
        }
        public HttpResponseMessage PutLiveStock_StepMaterial(int id, LiveStock_StepMaterial liveStock_StepMaterial)
        {
            if (!ModelState.IsValid)
            {
                return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty }));
            }

            if (id != liveStock_StepMaterial.Id)
            {
                return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty }));
            }

            try
            {
                LiveStock_StepMaterial LiveStock_StepMaterialData = db.LiveStock_StepMaterial.Where(a => a.Id == liveStock_StepMaterial.Id).FirstOrDefault();
                LiveStock_StepMaterialData.LiveMaterialName  = liveStock_StepMaterial.LiveMaterialName;
                LiveStock_StepMaterialData.LiveMaterialDesc  = liveStock_StepMaterial.LiveMaterialDesc;
                LiveStock_StepMaterialData.LiveStock_StepId  = liveStock_StepMaterial.LiveStock_StepId;
                LiveStock_StepMaterialData.Quantity          = liveStock_StepMaterial.Quantity;
                LiveStock_StepMaterialData.Cost              = liveStock_StepMaterial.Cost;
                LiveStock_StepMaterialData.Quantity_measured = liveStock_StepMaterial.Quantity_measured;
                LiveStock_StepMaterialData.Cost_measured     = liveStock_StepMaterial.Cost_measured;
                LiveStock_StepMaterialData.Category          = liveStock_StepMaterial.Category;
                LiveStock_StepMaterialData.Active            = liveStock_StepMaterial.Active;

                if (liveStock_StepMaterial.Active == true)
                {
                    LiveStock_StepMaterialData.UpdatedBy = liveStock_StepMaterial.UpdatedBy;
                    LiveStock_StepMaterialData.UpdatedOn = liveStock_StepMaterial.UpdatedOn;
                }
                else if (liveStock_StepMaterial.Active == false)
                {
                    LiveStock_StepMaterialData.ActiveBy = liveStock_StepMaterial.ActiveBy;
                    LiveStock_StepMaterialData.ActiveOn = liveStock_StepMaterial.ActiveOn;
                }
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LiveStock_StepMaterialExists(id))
                {
                    return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.NotFound, new { data = new { string.Empty }, success = false, error = string.Empty }));
                }
                else
                {
                    throw;
                }
            }

            return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { liveStock_StepMaterial }, success = true, error = string.Empty }));
        }
        public IHttpActionResult DeleteLiveStock_StepMaterial(int id)
        {
            LiveStock_StepMaterial liveStock_StepMaterial = db.LiveStock_StepMaterial.Find(id);

            if (liveStock_StepMaterial == null)
            {
                return(NotFound());
            }

            db.LiveStock_StepMaterial.Remove(liveStock_StepMaterial);
            db.SaveChanges();

            return(Ok(liveStock_StepMaterial));
        }