public ServiceResult <StoreInvoicingDetails> AddstoreInvoicingDetails(StoreInvoicingDetails storeInvoicingDetails) { var errors = new List <string>(); //if (string.IsNullOrEmpty(StoreInvoicingDetails.InvoicingId)) // errors.Add("Name is Null"); //if (_context.Customers.Any(a => a.Mobile == storeInvoicingDetails.Mobile)) // errors.Add("Mobile is dupplicate"); if (errors.Any()) { return(ServiceResult <StoreInvoicingDetails> .Failed(errors)); } storeInvoicingDetails.InvoicingDetailCreateDate = DateTime.Now; storeInvoicingDetails.IsDelete = false; _context.StoreInvoicingDetails.Add(storeInvoicingDetails); var result = _context.SaveChanges(); if (result > 0) { return(ServiceResult <StoreInvoicingDetails> .Succeed(storeInvoicingDetails)); } return(ServiceResult <StoreInvoicingDetails> .Failed(new List <string> { "Data not inserted!!!" })); }
public ServiceResult <Products> AddSubmitOrder(Products product, int customerId) { StoreInvoicingDetails storeInvoicingDetails = new StoreInvoicingDetails(); StoreInvoicing storeInvoicing = new StoreInvoicing(); storeInvoicingDetails.ProductId = product.Id; storeInvoicingDetails.CurrentPrice = product.UnitPrice; storeInvoicingDetails.Qty = product.NumberOfOrders; storeInvoicingDetails.InvoicingDetailCreateDate = DateTime.Now; storeInvoicingDetails.InvoicingDetailStatus = 1;//sabte sefaresh storeInvoicing.CustomerId = customerId; storeInvoicing.StoreInvoicingCreateDate = DateTime.Now; storeInvoicing.InvoicingDetailId = storeInvoicingDetails.Id; _context.StoreInvoicingDetails.Add(storeInvoicingDetails); _context.StoreInvoicings.Add(storeInvoicing); var result = _context.SaveChanges(); if (result > 0) { return(ServiceResult <Products> .Succeed(product)); } return(ServiceResult <Products> .Failed(new List <string> { "Data not inserted!!!" })); }
public ServiceResult <StoreInvoicingDetails> UpdatestoreInvoicingDetails(StoreInvoicingDetails storeInvoicingDetails) { throw new NotImplementedException(); }