public Enumerations.AddEntityStatus HandleQuote(Quote quote, PoRequest poRequest) { try { if (IsExistedProduct(quote.ProductName)) { var product = _productRepository.GetProductByProductName(quote.ProductName); quote.Image = product.Image; } else { HandleImage(quote, quote.CategoryName); } quote.PoRequest = poRequest; AddEntity(quote); return(Enumerations.AddEntityStatus.Success); } catch (Exception e) { return(Enumerations.AddEntityStatus.Failed); } }
//Call from PoRequestservice, get PoRequest history public static History GetStaffAssignAndAssetImage(this IRepository <History> repository, PoRequest poRequest) { return(repository.Entity.FirstOrDefault(_ => _.EmployeeID == poRequest.EmployeeID && _.Asset.Product.Category.CategoryName == poRequest.CategoryName && _.CheckinDate == poRequest.FinishedDate)); }