public HttpResponseMessage postStockInLine(Entities.TrnStockInLine stockInLine)
        {
            try
            {
                Data.TrnStockInLine newStockInLine = new Data.TrnStockInLine();
                newStockInLine.StockInId      = stockInLine.StockInId;
                newStockInLine.ItemId         = stockInLine.ItemId;
                newStockInLine.UnitId         = stockInLine.UnitId;
                newStockInLine.Quantity       = stockInLine.Quantity;
                newStockInLine.Cost           = stockInLine.Cost;
                newStockInLine.Amount         = stockInLine.Amount;
                newStockInLine.ExpiryDate     = stockInLine.ExpiryDate;
                newStockInLine.LotNumber      = stockInLine.LotNumber;
                newStockInLine.AssetAccountId = stockInLine.AssetAccountId;
                db.TrnStockInLines.InsertOnSubmit(newStockInLine);
                db.SubmitChanges();

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Something's wrong from the server."));
            }
        }
        public Int32 postStockInLine()
        {
            try
            {
                Data.TrnStockInLine newStockInLine = new Data.TrnStockInLine();
                newStockInLine.StockInId      = StockInId();
                newStockInLine.ItemId         = ItemId();
                newStockInLine.UnitId         = UnitId();
                newStockInLine.Quantity       = 0;
                newStockInLine.Cost           = 0;
                newStockInLine.Amount         = 0;
                newStockInLine.ExpiryDate     = DateTime.Today;
                newStockInLine.LotNumber      = "n/a";
                newStockInLine.AssetAccountId = AccountId();
                db.TrnStockInLines.InsertOnSubmit(newStockInLine);
                db.SubmitChanges();

                return(newStockInLine.Id);
            }
            catch (Exception e)
            {
                return(0);
            }
        }