public JsonResult Update(ProductDetailView vm) { GetProductRequest request = new GetProductRequest(); request.ProductID = vm.ProductID; ModifyProductRequest updateRequest = _productService.GetProduct(request).Product.ConvertToModifyProductRequest(); updateRequest.ProductID = vm.ProductID; updateRequest.ProductName = vm.ProductName; GetSupplierRequest supplierRequest = new GetSupplierRequest(); supplierRequest.SupplierID = vm.SupplierSupplierID; updateRequest.Supplier = _supplierService.GetSupplier(supplierRequest).Supplier; GetCategoryRequest categoryRequest = new GetCategoryRequest(); categoryRequest.CategoryID = vm.CategoryCategoryID; updateRequest.Category = _categoryService.GetCategory(categoryRequest).Category; updateRequest.QuantityPerUnit = vm.QuantityPerUnit; updateRequest.UnitPrice = vm.UnitPrice; updateRequest.UnitsInStock = vm.UnitsInStock; updateRequest.UnitsOnOrder = vm.UnitsOnOrder; updateRequest.ReorderLevel = vm.ReorderLevel; updateRequest.Discontinued = vm.Discontinued; ModifyProductResponse response = _productService.ModifyProduct(updateRequest); return(Json(response)); }
public JsonResult Update(SupplierDetailView vm) { GetSupplierRequest request = new GetSupplierRequest(); request.SupplierID = vm.SupplierID; ModifySupplierRequest updateRequest = _supplierService.GetSupplier(request).Supplier.ConvertToModifySupplierRequest(); updateRequest.SupplierID = vm.SupplierID; updateRequest.CompanyName = vm.CompanyName; updateRequest.ContactName = vm.ContactName; updateRequest.ContactTitle = vm.ContactTitle; updateRequest.Address = vm.Address; updateRequest.City = vm.City; updateRequest.Region = vm.Region; updateRequest.PostalCode = vm.PostalCode; updateRequest.Country = vm.Country; updateRequest.Phone = vm.Phone; updateRequest.Fax = vm.Fax; updateRequest.HomePage = vm.HomePage; ModifySupplierResponse response = _supplierService.ModifySupplier(updateRequest); return(Json(response)); }
public GetSupplierResponse GetSupplierById(GetSupplierRequest request) { GetSupplierResponse response = new GetSupplierResponse(); SupplierBusinessComponent bc = DependencyInjectionHelper.GetSupplierBusinessComponent(); Supplier supplier = bc.GetSupplierById(request.Id); response.Supplier = SupplierAdapter.SupplierToDto(supplier); return(response); }
public JsonResult GetSupplier(System.Int32 id) { DataTableViewModel data1; GetSupplierRequest request = new GetSupplierRequest(); request.SupplierID = id; DetailSupplier_SupplierDetailView data = _supplierService.GetSupplier(request).Supplier.ConvertToDetailSupplier_SupplierDetailView(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public GetSupplierResponse GetSupplierById(GetSupplierRequest request) { var bc = DependencyInjectionHelper.GetBusinessComponent <SupplierBusinessComponent>(); var supplier = bc.GetSupplierById(request.SupplierId); var response = new GetSupplierResponse(); response.Supplier = SupplierAdapter.SupplierToDTO(supplier); return(response); }
public JsonResult GetDetail(System.Int32 id) { SupplierDetailView vm = new SupplierDetailView(); GetSupplierRequest request = new GetSupplierRequest(); request.SupplierID = id; GetSupplierResponse response = _supplierService.GetSupplier(request); if (response.SupplierFound) { vm = response.Supplier.ConvertToSupplierDetailView(); } return(Json(vm, JsonRequestBehavior.AllowGet)); }
public SupplierDTO GetSupplierById(int id) { try { GetSupplierRequest request = new GetSupplierRequest(); request.Id = id; GetSupplierResponse response = Service.GetSupplierById(request); return(response.Supplier); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, "PL Policy")) { throw; } return(new SupplierDTO()); } }
public JsonResult GetProductDataTable(System.Int32 id) { DataTableViewModel data; GetSupplierRequest request = new GetSupplierRequest(); request.SupplierID = id; SupplierView supplier = _supplierService.GetSupplier(request).Supplier; data = new DataTableViewModel(); data.draw = "1"; data.recordsTotal = supplier.Products.ToList().Count.ToString(); data.recordsFiltered = supplier.Products.ToList().Count.ToString(); data.data = supplier.Products.ConvertToDetailSupplierProductDetailViews().ToList <object>(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public SupplierDTO GetSupplierById(int supplierId) { try { var request = new GetSupplierRequest(); request.SupplierId = supplierId; var response = this.Service.GetSupplierById(request); return(response.Supplier); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, "PL Policy")) { throw; } return(new SupplierDTO()); } }
/// <summary> /// Get suppliers /// </summary> /// <param name="request">request for getting suppliers</param> /// <returns>returns response of the operation</returns> public GetSupplierResponse Get(GetSupplierRequest request) { //get all suppliers var supplierEntities = _supplierRepository.Get(); //Map entity to response dto var suppliers = supplierEntities.Select(x => new SupplierDTO { ID = x.ID, Latitude = x.Latitude, Longitude = x.Longitude, SatisfactionIndex = x.SatisfactionIndex }); return new GetSupplierResponse { Suppliers = suppliers.ToList() }; }
public GetSupplierResponse GetSupplier(GetSupplierRequest request) { GetSupplierResponse response = new GetSupplierResponse(); Supplier supplier = _supplierRepository .FindBy(request.SupplierID); if (supplier != null) { response.SupplierFound = true; response.Supplier = supplier.ConvertToSupplierView(); } else { response.SupplierFound = false; } return(response); }
public JsonResult Create(ProductDetailView vm) { CreateProductRequest request = new CreateProductRequest(); request.ProductName = vm.ProductName; GetSupplierRequest supplierRequest = new GetSupplierRequest(); supplierRequest.SupplierID = vm.SupplierSupplierID; request.Supplier = _supplierService.GetSupplier(supplierRequest).Supplier; GetCategoryRequest categoryRequest = new GetCategoryRequest(); categoryRequest.CategoryID = vm.CategoryCategoryID; request.Category = _categoryService.GetCategory(categoryRequest).Category; request.QuantityPerUnit = vm.QuantityPerUnit; request.UnitPrice = vm.UnitPrice; request.UnitsInStock = vm.UnitsInStock; request.UnitsOnOrder = vm.UnitsOnOrder; request.ReorderLevel = vm.ReorderLevel; request.Discontinued = vm.Discontinued; CreateProductResponse response = _productService.CreateProduct(request); return(Json(response)); }