Example #1
0
        public HttpResponseMessage unlockStockIn(String id, Models.TrnStockIn stockIn)
        {
            try
            {
                var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault();

                var stockIns = from d in db.TrnStockIns where d.Id == Convert.ToInt32(id) select d;
                if (stockIns.Any())
                {
                    var updateStockIn = stockIns.FirstOrDefault();

                    updateStockIn.IsLocked        = false;
                    updateStockIn.UpdatedById     = userId;
                    updateStockIn.UpdatedDateTime = DateTime.Now;

                    db.SubmitChanges();

                    inventory.deleteINInventory(Convert.ToInt32(id));
                    journal.deleteINJournal(Convert.ToInt32(id));

                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }