public ICollection <TabelaPreco> Get() { using (var context = new WebServiceDBContext()) { return(context.TabelaPrecos.ToList()); } }
public ICollection <TypeProduct> Get() { using (var context = new WebServiceDBContext()) { return(context.TypeProduct.ToList()); } }
public void Post([FromBody] TypeProduct tp) { using (var context = new WebServiceDBContext()) { context.TypeProduct.Add(tp); context.SaveChanges(); } }
public void Put([FromBody] TypeProduct tp) { using (var context = new WebServiceDBContext()) { context.Entry(tp).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void Post([FromBody] Product p) { using (var context = new WebServiceDBContext()) { context.Produtcs.Add(p); context.SaveChanges(); } }
public void Put([FromBody] TabelaPreco tb) { using (var context = new WebServiceDBContext()) { context.Entry(tb).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public List <Notice> GetNoticeList() { using (var db = new WebServiceDBContext(_configuration)) { return(db.Notices .OrderByDescending(n => n.NoticeNo) .ToList()); } }
/// <summary> /// 1. 리뷰 목록 /// </summary> /// <returns></returns> public List <Review> GetReviewList() { using (var db = new WebServiceDBContext(_configuration)) { return(db.Reviews .OrderByDescending(n => n.ReviewNo) .ToList()); } }
public Product Get(long id) { Product prod = null; using (var context = new WebServiceDBContext()) { prod = context.Produtcs.Find(id); } return(prod); }
public TabelaPreco Get(long id) { TabelaPreco tb = null; using (var context = new WebServiceDBContext()) { tb = context.TabelaPrecos.Find(id); } return(tb); }
public TypeProduct Get(long id) { TypeProduct tp = null; using (var context = new WebServiceDBContext()) { tp = context.TypeProduct.Find(id); } return(tp); }
public HttpResponseMessage Delete(long id) { using (var context = new WebServiceDBContext()) { TypeProduct tp = context.TypeProduct.Find(id); context.Entry(tp).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } return(new HttpResponseMessage(HttpStatusCode.Accepted)); }
public void Post([FromBody] TabelaPreco tp) { using (var context = new WebServiceDBContext()) { foreach (Product p in tp.producs) { context.Produtcs.Attach(p); context.Entry(p).State = System.Data.Entity.EntityState.Unchanged; } context.TabelaPrecos.Add(tp); context.SaveChanges(); } }
public void GenerateFiveRandomSummaries() { // Arrange var builder = new DbContextOptionsBuilder <WebServiceDBContext>(); builder.UseSqlServer("Data Source = (localdb)\\MSSQLLocalDB; Initial Catalog = WeatherForecaster"); using (var dbContext = new WebServiceDBContext(builder.Options)) { var forecaster = new WeatherForecaster(dbContext); // Act var weatherSummaries = forecaster.WeatherSummaires(); // Assert Assert.IsTrue(weatherSummaries.Length == 5); }; }
//[TestMethod] public void GetFiveSummariesFromDatabase() { // Arrange var builder = new DbContextOptionsBuilder <WebServiceDBContext>(); builder.UseSqlServer("Data Source = (localdb)\\MSSQLLocalDB; Initial Catalog = WeatherForecaster"); using (var dbContext = new WebServiceDBContext(builder.Options)) { var forecaster = new WeatherForecaster(dbContext); // Act var weatherSummaries = forecaster.WeatherSummariesFromDatabase().Result; // Assert Assert.IsTrue(weatherSummaries.Count == 5); }; }
/// <summary> /// Initializes a new instance of the <see cref="WeatherForecaster"/> class. /// </summary> /// <param name="context">DBContext.</param> public WeatherForecaster(WebServiceDBContext context) { _dbContext = context; }
/// <summary> /// Initializes a new instance of the <see cref="GeneralContactsService"/> class. /// </summary> /// <param name="context">DBContext.</param> public GeneralContactsService(WebServiceDBContext context) { _dbContext = context; }