public ActionResult Save(ExtMvc.Dtos.OrderDetailDto item) { using(_conversation.SetAsCurrent()) { var itemMapped = _mapper.Map<ExtMvc.Dtos.OrderDetailDto, ExtMvc.Domain.OrderDetail>(item); Nexida.Infrastructure.Mvc.ValidationHelpers.AddErrorsToModelState(ModelState, _validator.Validate(itemMapped), "item"); if (ModelState.IsValid) { var isNew = string.IsNullOrEmpty(item.StringId); if(isNew) { _repository.Create(itemMapped); } if(!isNew) { _repository.Update(itemMapped); } _conversation.Flush(); } return Json(new{ success = ModelState.IsValid, errors = Nexida.Infrastructure.Mvc.ValidationHelpers.BuildErrorDictionary(ModelState), }); } }
public IPresentableSet<ExtMvc.Domain.Product> SearchNormal(int? productId, string productName, bool? discontinued, ExtMvc.Domain.Ns.Category category, ExtMvc.Domain.Supplier supplier) { IQueryable<ExtMvc.Domain.Product> queryable = _northwind.GetCurrentSession().Linq<ExtMvc.Domain.Product>(); if(productId != default(int?)) { queryable = queryable.Where(x => x.ProductId == productId); } if(!string.IsNullOrEmpty(productName)) { queryable = queryable.Where(x => x.ProductName.StartsWith(productName)); } if(discontinued != default(bool?)) { queryable = queryable.Where(x => x.Discontinued == discontinued); } if(category != default(ExtMvc.Domain.Ns.Category)) { queryable = queryable.Where(x => x.Category == category); } if(supplier != default(ExtMvc.Domain.Supplier)) { queryable = queryable.Where(x => x.Supplier == supplier); } return new Nexida.Infrastructure.QueryablePresentableSet<ExtMvc.Domain.Product>(queryable); }
public OrderDetailController(Conversation.IConversation conversation, AutoMapper.IMappingEngine mapper, ExtMvc.Data.OrderDetailRepository repository, Nexida.Infrastructure.IValidator validator, Nexida.Infrastructure.IStringConverter<ExtMvc.Domain.OrderDetail> stringConverter) { _conversation = conversation; _mapper = mapper; _repository = repository; _validator = validator; _stringConverter = stringConverter; }
public static void Associate(ExtMvc.Domain.Shipper item1, ExtMvc.Domain.Order item2) { if(item2.Shipper != null) { item2.Shipper.Orders.Remove(item2); } item2.Shipper = item1; if (item2.Shipper != null) { item1.Orders.Add(item2); } }
public static void Associate(ExtMvc.Domain.Supplier item1, ExtMvc.Domain.Product item2) { if(item2.Supplier != null) { item2.Supplier.Products.Remove(item2); } item2.Supplier = item1; if (item2.Supplier != null) { item1.Products.Add(item2); } }
public static void Associate(ExtMvc.Domain.Product item1, ExtMvc.Domain.Ns.Category item2) { if(item1.Category != null) { item1.Category.Products.Remove(item1); } item1.Category = item2; if(item1.Category != null) { item1.Category.Products.Add(item1); } }
public static void Associate(ExtMvc.Domain.Ns.Employee item1, ExtMvc.Domain.Ns.Employee item2) { if(item2.RelatedEmployee != null) { item2.RelatedEmployee.Employees.Remove(item2); } item2.RelatedEmployee = item1; if (item2.RelatedEmployee != null) { item1.Employees.Add(item2); } }
public static void Associate(ExtMvc.Domain.Order item1, ExtMvc.Domain.Ns.Employee item2) { if(item1.Employee != null) { item1.Employee.Orders.Remove(item1); } item1.Employee = item2; if(item1.Employee != null) { item1.Employee.Orders.Add(item1); } }
public static void Associate(ExtMvc.Domain.Order item1, ExtMvc.Domain.Ns.Customer item2) { if(item1.Customer != null) { item1.Customer.Orders.Remove(item1); } item1.Customer = item2; if(item1.Customer != null) { item1.Customer.Orders.Add(item1); } }
public static void Associate(ExtMvc.Domain.Territory item1, ExtMvc.Domain.Region item2) { if(item1.Region != null) { item1.Region.Territories.Remove(item1); } item1.Region = item2; if(item1.Region != null) { item1.Region.Territories.Add(item1); } }
public ActionResult SearchNormal(int? productId, string productName, bool? discontinued, ExtMvc.Dtos.Ns.CategoryReferenceDto category, ExtMvc.Dtos.SupplierReferenceDto supplier, int start, int limit, string sort, string dir) { Log.DebugFormat("SearchNormal called"); using(_conversation.SetAsCurrent()) { var categoryMapped = _mapper.Map<ExtMvc.Dtos.Ns.CategoryReferenceDto, ExtMvc.Domain.Ns.Category>(category); var supplierMapped = _mapper.Map<ExtMvc.Dtos.SupplierReferenceDto, ExtMvc.Domain.Supplier>(supplier); var set = _repository.SearchNormal(productId, productName, discontinued, categoryMapped, supplierMapped); var items = set.Skip(start).Take(limit).Sort(sort, dir == "ASC").AsEnumerable(); var dtos = _mapper.Map<IEnumerable<ExtMvc.Domain.Product>, ExtMvc.Dtos.ProductDto[]>(items); return Json(new{ items = dtos, count = set.Count() }); } }
public ActionResult SearchNormal(int? orderId, System.DateTime? orderDate, System.DateTime? requiredDate, System.DateTime? shippedDate, decimal? freight, ExtMvc.Dtos.AddressDto address, ExtMvc.Dtos.Ns.CustomerReferenceDto customer, ExtMvc.Dtos.Ns.EmployeeReferenceDto employee, ExtMvc.Dtos.ShipperReferenceDto shipper, int start, int limit, string sort, string dir) { Log.DebugFormat("SearchNormal called"); using(_conversation.SetAsCurrent()) { var addressMapped = _mapper.Map<ExtMvc.Dtos.AddressDto, ExtMvc.Domain.Address>(address); var customerMapped = _mapper.Map<ExtMvc.Dtos.Ns.CustomerReferenceDto, ExtMvc.Domain.Ns.Customer>(customer); var employeeMapped = _mapper.Map<ExtMvc.Dtos.Ns.EmployeeReferenceDto, ExtMvc.Domain.Ns.Employee>(employee); var shipperMapped = _mapper.Map<ExtMvc.Dtos.ShipperReferenceDto, ExtMvc.Domain.Shipper>(shipper); var set = _repository.SearchNormal(orderId, orderDate, requiredDate, shippedDate, freight, addressMapped, customerMapped, employeeMapped, shipperMapped); var items = set.Skip(start).Take(limit).Sort(sort, dir == "ASC").AsEnumerable(); var dtos = _mapper.Map<IEnumerable<ExtMvc.Domain.Order>, ExtMvc.Dtos.OrderDto[]>(items); return Json(new{ items = dtos, count = set.Count() }); } }
public IPresentableSet<ExtMvc.Domain.Order> SearchNormal(int? orderId, System.DateTime? orderDate, System.DateTime? requiredDate, System.DateTime? shippedDate, decimal? freight, ExtMvc.Domain.Address address, ExtMvc.Domain.Ns.Customer customer, ExtMvc.Domain.Ns.Employee employee, ExtMvc.Domain.Shipper shipper) { IQueryable<ExtMvc.Domain.Order> queryable = _northwind.GetCurrentSession().Linq<ExtMvc.Domain.Order>(); if(orderId != default(int?)) { queryable = queryable.Where(x => x.OrderId == orderId); } if(orderDate != default(System.DateTime?)) { queryable = queryable.Where(x => x.OrderDate == orderDate); } if(requiredDate != default(System.DateTime?)) { queryable = queryable.Where(x => x.RequiredDate == requiredDate); } if(shippedDate != default(System.DateTime?)) { queryable = queryable.Where(x => x.ShippedDate == shippedDate); } if(freight != default(decimal?)) { queryable = queryable.Where(x => x.Freight == freight); } if(address != default(ExtMvc.Domain.Address)) { #warning Nexida.CodeGen.Warning: FieldName not specified in model, you have to manually implement filter } if(customer != default(ExtMvc.Domain.Ns.Customer)) { queryable = queryable.Where(x => x.Customer == customer); } if(employee != default(ExtMvc.Domain.Ns.Employee)) { queryable = queryable.Where(x => x.Employee == employee); } if(shipper != default(ExtMvc.Domain.Shipper)) { queryable = queryable.Where(x => x.Shipper == shipper); } return new Nexida.Infrastructure.QueryablePresentableSet<ExtMvc.Domain.Order>(queryable); }
public void Update(ExtMvc.Domain.OrderDetail v) { _northwind.GetCurrentSession().Update(v); }
public static void Disassociate(ExtMvc.Domain.Territory item1, ExtMvc.Domain.Region item2) { item1.Region = null; item2.Territories.Remove(item1); }
public void Update(ExtMvc.Domain.Product v) { _northwind.GetCurrentSession().Update(v); }
public void Delete(ExtMvc.Domain.Territory v) { _northwind.GetCurrentSession().Delete(v); }
public void Update(ExtMvc.Domain.Ns.CustomerDemographic v) { _northwind.GetCurrentSession().Update(v); }
public static void Disassociate(ExtMvc.Domain.Territory item1, ExtMvc.Domain.Ns.Employee item2) { item1.Employees.Remove(item2); item2.Territories.Remove(item1); }
public static void Disassociate(ExtMvc.Domain.Ns.Employee item1, ExtMvc.Domain.Ns.Employee item2) { item1.Employees.Remove(item2); item2.RelatedEmployee = null; }
public static void Disassociate(ExtMvc.Domain.Order item1, ExtMvc.Domain.Ns.Employee item2) { item1.Employee = null; item2.Orders.Remove(item1); }
public void Update(ExtMvc.Domain.Ns.Category v) { _northwind.GetCurrentSession().Update(v); }
public static void Associate(ExtMvc.Domain.Ns.Customer item1, ExtMvc.Domain.Ns.CustomerDemographic item2) { item1.Customerdemographics.Add(item2); item2.Customers.Add(item1); }
public void Update(ExtMvc.Domain.Ns.Employee v) { _northwind.GetCurrentSession().Update(v); }
public static void Disassociate(ExtMvc.Domain.Shipper item1, ExtMvc.Domain.Order item2) { item1.Orders.Remove(item2); item2.Shipper = null; }
public void Create(ExtMvc.Domain.Region v) { _northwind.GetCurrentSession().Save(v); }
public static void Disassociate(ExtMvc.Domain.Order item1, ExtMvc.Domain.Ns.Customer item2) { item1.Customer = null; item2.Orders.Remove(item1); }
public void Delete(ExtMvc.Domain.Region v) { _northwind.GetCurrentSession().Delete(v); }
public void Update(ExtMvc.Domain.Shipper v) { _northwind.GetCurrentSession().Update(v); }
public static void Associate(ExtMvc.Domain.Territory item1, ExtMvc.Domain.Ns.Employee item2) { item1.Employees.Add(item2); item2.Territories.Add(item1); }