Пример #1
0
 public string AddCustomerOrder(CustomerOrderViewModel obj)
 {
     try
     {
         using (NavAssignmentEntities db = new NavAssignmentEntities())
         {
             Order orderObj = new Order();
             orderObj.CustomerId   = obj.CustomerId;
             orderObj.OrderType    = obj.OrderType;
             orderObj.PaymentType  = obj.PaymentType;
             orderObj.GrandTotal   = obj.GrandTotal;
             orderObj.deliveryDate = obj.deliveryDate;
             orderObj.isStatus     = true;
             orderObj.createdDate  = orderObj.updatedDate = DateTime.Now;
             orderObj.noofItems    = obj.noofItems;
             db.Orders.Add(orderObj);
             db.SaveChanges();
             return("Ok");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
 public string DeleteUser(int id)
 {
     try
     {
         using (NavAssignmentEntities db = new NavAssignmentEntities())
         {
             Customer cus = db.Customers.Where(m => m.customerId == id).FirstOrDefault();
             cus.isStatus = false;
             db.SaveChanges();
             return("Ok");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
 public string DeleteProduct(int id)
 {
     try
     {
         using (NavAssignmentEntities db = new NavAssignmentEntities())
         {
             Product cus = db.Products.Where(m => m.productId == id).FirstOrDefault();
             cus.isStatus = false;
             db.SaveChanges();
             return("Ok");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
0
 public string AddProduct(ProductViewModel obj)
 {
     try
     {
         using (NavAssignmentEntities db = new NavAssignmentEntities())
         {
             Product pro = new Product();
             pro.productName        = obj.productName;
             pro.code               = obj.code;
             pro.productDescription = obj.productDescription;
             pro.stockQuantity      = obj.stockQuantity;
             pro.updatedDate        = pro.createdDate = DateTime.Now;
             pro.isStatus           = true;
             db.Products.Add(pro);
             db.SaveChanges();
             return("Ok");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public string AddCustomerOrderItems(CustomerOrderItemViewModel obj)
 {
     try
     {
         using (NavAssignmentEntities db = new NavAssignmentEntities())
         {
             OrderItem orderObj = new OrderItem();
             orderObj.OrderID        = obj.OrderID;
             orderObj.productId      = obj.productId;
             orderObj.itemPrice      = obj.itemPrice;
             orderObj.GrandTotal     = obj.GrandTotal;
             orderObj.DiscountAmount = obj.DiscountAmount;
             orderObj.isStatus       = true;
             orderObj.createdDate    = orderObj.updatedDate = DateTime.Now;
             db.OrderItems.Add(orderObj);
             db.SaveChanges();
             return("Ok");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #6
0
 public string AddUser(RegisterViewModel obj)
 {
     try
     {
         using (NavAssignmentEntities db = new NavAssignmentEntities())
         {
             Customer cus = new Customer();
             cus.customername    = obj.customername;
             cus.emailId         = obj.emailId;
             cus.customerAddress = obj.customerAddress;
             cus.gender          = obj.gender;
             cus.mobileNumber    = obj.mobileNumber;
             cus.updatedDate     = cus.createdDate = DateTime.Now;
             cus.isStatus        = true;
             db.Customers.Add(cus);
             db.SaveChanges();
             return("Ok");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }