/// <summary> /// Updates the product. /// </summary> /// <param name="model">The model.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public async Task <bool> UpdateProduct(UpLoadProductModel model) { var query = _productRepository.GetById(model.ProductId); query.CategoryId = model.CategoryId; query.Description = model.Description; query.Name = model.Name; query.Price = model.Price; query.ImageLink = model.file; _productRepository.Update(query); await _unitOfWork.CommitAsync(); return(true); }
/// <summary> /// Adds the product. /// </summary> /// <param name="model">The model.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public async Task <bool> AddProduct(UpLoadProductModel model) { var a = _productRepository.Insert(new TblProduct { ProductId = model.ProductId, CategoryId = model.CategoryId, Description = model.Description, Name = model.Name, Price = model.Price, ImageLink = model.file }); await _unitOfWork.CommitAsync(); return(true); }
public async Task AddProduct([FromBody] UpLoadProductModel model) { await _productService.AddProduct(model); Response.StatusCode = (int)HttpStatusCode.OK; }