Beispiel #1
0
 //Get the details of a particular sale
 public SalesModel GetSaleData(int id)
 {
     try
     {
         SalesModel sale = db.Sales.Find(id);
         return(sale);
     }
     catch
     {
         throw;
     }
 }
Beispiel #2
0
 //To create a new sale item
 public int CreateSale(SalesModel sale)
 {
     try
     {
         db.Sales.Add(sale);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Beispiel #3
0
 //To Delete the record of a particular sale
 public int DeleteSale(int id)
 {
     try
     {
         SalesModel sold = db.Sales.Find(id);
         db.Sales.Remove(sold);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Beispiel #4
0
        //To Update the records of a particluar sale
        public int UpdateSale(SalesModel sale)
        {
            try
            {
                db.Entry(sale).State = EntityState.Modified;
                db.SaveChanges();

                return(1);
            }
            catch
            {
                throw;
            }
        }