Ejemplo n.º 1
0
        public SaveResult Add(OrderDetailDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (OrderAppEntities context = new OrderAppEntities())
                {
                    OrderDetail add = context.OrderDetails.Create();

                    add.OrderId   = entity.OrderId;
                    add.ProductId = entity.ProductId;
                    add.Quantity  = entity.Quantity;
                    add.UnitPrice = entity.UnitPrice;

                    context.Entry <OrderDetail>(add).State = System.Data.Entity.EntityState.Added;
                    return(context.SaveChanges() > 0 ? result = SaveResult.SUCCESS : result = SaveResult.FAILURE);
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

            return(result);
        }
Ejemplo n.º 2
0
 public System.Threading.Tasks.Task <SaveResult> DeleteAsync(OrderDetailDto entity)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 3
0
 public SaveResult Delete(OrderDetailDto entity)
 {
     throw new System.NotImplementedException();
 }