public PrqSupplierBillItem SetToBussinessObject(Prq_SupplierBillItem entity)
        {
            var model = new PrqSupplierBillItem();

            model.SupplierBillID = entity.SupplierBillID;
            model.BillItemID     = entity.BillItemID;
            model.ItemTypeID     = entity.ItemType;
            model.ItemTypeName   =
                _context.Sys_ItemType.Where(w => w.ItemTypeID == entity.ItemType).FirstOrDefault().ItemTypeName;
            model.ItemSizeID   = entity.ItemSize;
            model.ItemSizeName = _context.Sys_Size.Where(w => w.SizeID == entity.ItemSize).FirstOrDefault().SizeName;
            model.ItemQty      = entity.ItemQty;
            model.RejectQty    = entity.RejectQty;
            model.ItemRate     = entity.ItemRate;
            model.ApproveRate  = entity.ApproveRate;
            model.Amount       = entity.Amount;
            model.AmtUnit      = entity.AmtUnit ?? 0;
            if (entity.AmtUnit != 0)
            {
                model.AmtUnitName = _context.Sys_Currency.Where(w => w.CurrencyID == entity.AmtUnit).FirstOrDefault().CurrencyName;
            }
            model.AvgArea  = entity.AvgArea;
            model.AreaUnit = entity.AreaUnit ?? 0;
            if (entity.AreaUnit != 0)
            {
                model.AreaUnitName = _context.Sys_Unit.Where(w => w.UnitID == entity.AreaUnit).FirstOrDefault().UnitName;
            }
            model.Remarks = entity.Remarks;

            return(model);
        }
 public ValidationMsg DeleteBillItem(long itemId)
 {
     try
     {
         Prq_SupplierBillItem deleteSupplierBillItem =
             _context.Prq_SupplierBillItem.SingleOrDefault(w => w.BillItemID == itemId);
         _context.Prq_SupplierBillItem.Remove(deleteSupplierBillItem);
         _context.SaveChanges();
         _vmMsg.Type = Enums.MessageType.Delete;
         _vmMsg.Msg  = "Bill item is deleted successfully ";
     }
     catch (Exception)
     {
         _vmMsg.Type = Enums.MessageType.Error;
         _vmMsg.Msg  = "Failed to delete bill item.";
     }
     return(_vmMsg);
 }