// POST api/RequestForQuotation
        public HttpResponseMessage PostRequestForQuotation(RequestForQuotation requestforquotation)
        {
            if (ModelState.IsValid)
            {
                string CustomCode = "ARQ-" + DateTime.Now.ToString("yyyyMMdd");

                int? MaxCode = Convert.ToInt32((db.RequestForQuotations.Where(r => r.RequestForQuotationCode.StartsWith(CustomCode)).Select(r => r.RequestForQuotationCode.Substring(CustomCode.Length, 4)).ToList()).Max());
                string QRCode = CustomCode + ((MaxCode + 1).ToString()).PadLeft(4, '0');
                requestforquotation.RequestForQuotationCode = QRCode;
                requestforquotation.InsertBy = loginUser.UserID;

                db.RequestForQuotations.Add(requestforquotation);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, requestforquotation);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = requestforquotation.RequestForQuotationID }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
        // PUT api/RequestForQuotation/5
        public HttpResponseMessage PutRequestForQuotation(long id, RequestForQuotation requestforquotation)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != requestforquotation.RequestForQuotationID)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
            requestforquotation.ProcesStatus = null;
            requestforquotation.Collaborator = null;
            requestforquotation.UpdateBy = loginUser.UserID;
            db.Entry(requestforquotation).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }