Beispiel #1
0
        // POST: api/LPRetrieve
        public HttpResponseMessage Post([FromBody] RetrieveFromStorage entity)
        {
            try
            {
                if (entity != null)
                {
                    BusinessLayer BL  = new BusinessLayer();
                    string        msg = BL.InsertLPRetrieveFromStorage(entity);

                    if (msg == "")
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, msg));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotAcceptable, msg));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Entity Is Null!"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
        }
Beispiel #2
0
        //// GET: api/LPRetrieve
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        // GET: api/LPRetrieve/5
        public HttpResponseMessage Get(string Company = null, string PartNum = null, string LotNum = null)
        {
            try
            {
                if (!string.IsNullOrEmpty(PartNum) && !string.IsNullOrEmpty(Company) && !string.IsNullOrEmpty(LotNum))
                {
                    BusinessLayer       BL     = new BusinessLayer();
                    RetrieveFromStorage entity = BL.GetLotFromStorage(Company, PartNum, LotNum);
                    if (entity != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, entity));
                    }
                    else
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                           $"LotNum {LotNum} was not belong to the selected product!"));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                       $"PartNum Or Company Or LotNum is Null!"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
        }