public bool SalesLotSaveEdit(MLot lot)
        {
            bool status = false;

            if (lot.iLotID > 0)
            {
                //Edit Existing Record
                var lots = auctionContext.MLots.Where(a => a.iLotID == lot.iLotID).FirstOrDefault();
                if (lots != null)
                {
                    lots.strLotName  = lot.strLotName;
                    lots.strFromDate = lot.strFromDate;
                    lots.dtFromDate  = lot.dtFromDate;
                    lots.strToDate   = lot.strToDate;
                    lots.dtToDate    = lot.dtToDate;
                    lots.chLotType   = lot.chLotType;
                }
            }
            else
            {
                //Save
                auctionContext.MLots.Add(lot);
            }
            auctionContext.SaveChanges();
            status = true;
            return(status);
        }
        public MLot GetLot(int id)
        {
            MLot lot = new MLot();

            lot = auctionContext.MLots.Where(a => a.iLotID == id).FirstOrDefault();
            return(lot);
        }
Пример #3
0
 public virtual bool ChangeLot(MLot New)
 {
     uow.Lots.Update(new Lot {
         Lot_Name = New.Lot_Name, Price = New.Price, User_FK = New.User_FK, IsBought = New.IsBought, IsActive = New.IsActive, Current_Price = New.Current_Price, Category = New.Category, Lot_ID = New.Lot_ID, User_Bought_FK = New.User_Bought_FK
     });
     uow.Save();
     return(true);
 }
Пример #4
0
 public virtual bool AddLot(MLot New)
 {
     uow.Lots.Create(new Lot {
         Lot_Name = New.Lot_Name, Price = New.Price, User_FK = New.User_FK, IsBought = false, IsActive = false, Current_Price = null, Category = New.Category
     });
     uow.Save();
     return(true);
 }
Пример #5
0
        private MLot ParserAddExpenseLot(Lots lot)
        {
            MLot mlot = new MLot();

            if (mlot != null)
            {
                mlot.iLotID      = lot.iLotID;
                mlot.strLotName  = lot.strLotName ?? " ";
                mlot.strFromDate = lot.strFromDate ?? " ";
                mlot.dtFromDate  = lot.dtFromDate;
                mlot.strToDate   = lot.strToDate;
                mlot.dtToDate    = lot.dtToDate;
                mlot.chLotType   = lot.chLotType ?? " ";
            }
            return(mlot);
        }
Пример #6
0
        private MLot ParserSalesLot(dynamic data)
        {
            MLot lot = new MLot();

            if (data != null)
            {
                // supplier.FullName = data.FullName;
                lot.iLotID      = data.iLotID ?? -1;
                lot.strLotName  = data.strLotName ?? " ";
                lot.strFromDate = data.strMiddleName ?? " ";
                lot.dtFromDate  = data.dtFromDate ?? " ";
                lot.strToDate   = data.strToDate ?? " ";
                lot.dtToDate    = data.dtToDate ?? " ";
                lot.chLotType   = data.chLotType ?? " ";
            }
            return(lot);
        }
 // PUT: api/Lot/5
 public void Put(int id, [FromBody] MLot value)
 {
     value.Lot_ID = id;
     la.ChangeLot(value);
 }
 // POST: api/Lot
 public void Post([FromBody] MLot value)
 {
     la.AddLot(value);
 }