public IHttpActionResult GetStandardPrice(int StandardPriceId) { try { StandardPrice standardPrice = new StandardPrice(); using (UnitOfWork uow = new UnitOfWork()) { standardPrice = uow.StandardPriceRepository.Get(x => x.StandardPriceId == StandardPriceId && x.FarmID == FARMID); standardPrice = standardPrice == null ? new StandardPrice { StandardPriceId = -1 } : standardPrice; var currencyList = uow.LookupRepository.GetAll(x => x.LookupCategory == Utility.CONFIG_CURRENCY).ToList(); return(Ok(new { standardPrice, currencyList })); } } catch (Exception ex) { throw ex; } }
public void Delete(StandardPrice entity) { try { entities.StandardPrices.Remove(entity); } catch (Exception ex) { throw ex; } }
public void Add(StandardPrice entity) { try { entities.StandardPrices.Add(entity); } catch (Exception ex) { throw ex; } }
public void Attach(StandardPrice entity) { try { entities.StandardPrices.Attach(entity); entities.Entry(entity).State = EntityState.Modified; } catch (Exception ex) { throw ex; } }
public IHttpActionResult Save(StandardPrice standardPrice) { try { StandardPrice standardPricedtl = new StandardPrice(); using (UnitOfWork uow = new UnitOfWork()) { if (standardPrice.StandardPriceId == -1) { standardPricedtl = standardPrice; standardPricedtl.CreatedBy = "ADMIN"; standardPricedtl.CreatedOn = DateTime.UtcNow; } else { standardPricedtl = uow.StandardPriceRepository.Get(x => x.StandardPriceId == standardPrice.StandardPriceId); standardPricedtl.SireCode = standardPrice.SireCode; standardPricedtl.BreederCode = standardPrice.BreederCode; standardPricedtl.Price = standardPrice.Price; standardPricedtl.CurrencyCode = standardPrice.CurrencyCode; standardPricedtl.ExRate = standardPrice.ExRate; standardPricedtl.LocalPrice = standardPrice.LocalPrice; standardPricedtl.IsActive = standardPrice.IsActive; standardPricedtl.ModifiedBy = "ADMIN"; standardPricedtl.ModifiedOn = DateTime.UtcNow; } standardPricedtl.FarmID = FARMID; uow.StandardPriceRepository.Save(standardPricedtl); uow.SaveChanges(); return(Ok(new { })); } } catch (Exception ex) { throw ex; } }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (AverageLeadTime == default(int) ? 0 : AverageLeadTime.GetHashCode()); hash = hash * 23 + (BusinessEntityId == default(int) ? 0 : BusinessEntityId.GetHashCode()); hash = hash * 23 + (LastReceiptCost == null ? 0 : LastReceiptCost.GetHashCode()); hash = hash * 23 + (LastReceiptDate == null ? 0 : LastReceiptDate.GetHashCode()); hash = hash * 23 + (MaxOrderQty == default(int) ? 0 : MaxOrderQty.GetHashCode()); hash = hash * 23 + (MinOrderQty == default(int) ? 0 : MinOrderQty.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (OnOrderQty == null ? 0 : OnOrderQty.GetHashCode()); hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode()); hash = hash * 23 + (StandardPrice == default(decimal) ? 0 : StandardPrice.GetHashCode()); hash = hash * 23 + (UnitMeasureCode == null ? 0 : UnitMeasureCode.GetHashCode()); return(hash); } }
public void Save(StandardPrice entity) { try { StandardPrice standardPrice = entities.StandardPrices .Where(x => x.FarmID == entity.FarmID && x.StandardPriceId == entity.StandardPriceId).FirstOrDefault(); if (standardPrice != null) { entities.Entry(standardPrice).State = EntityState.Modified; } else { Add(entity); } } catch (Exception ex) { throw ex; } }