public OPResult SetPosition(int shopid, decimal?lng, decimal?lat) { using (var dbContext = new SysProcessEntities()) { try { var organization = dbContext.SysOrganization.Find(shopid); organization.Longitude = lng; organization.Latitude = lat; dbContext.SaveChanges(); } catch (Exception e) { return(new OPResult { IsSucceed = false, Message = e.Message }); } } return(new OPResult { IsSucceed = true }); }
public ProductColorSize GetStyleColorSize(string bname, string pcode) { using (var dbContext = new SysProcessEntities()) { var query = from product in dbContext.Product from style in dbContext.ProStyle where product.StyleID == style.ID && style.Code == pcode from color in dbContext.ProColor where product.ColorID == color.ID from size in dbContext.ProSize where product.SizeID == size.ID select new { ColorName = color.Name, SizeName = size.Name, SizeID = size.ID }; var data = query.ToList(); var pcs = new ProductColorSize(); pcs.ColorNames = data.Select(o => o.ColorName).Distinct(); pcs.SizeNames = data.OrderBy(o => o.SizeID).Select(o => o.SizeName).Distinct(); return(pcs); } }