// GET: Supp/Edit public ActionResult Edit(int id) { var context = new PhoneDbContext(); var supply = context.Suppliers.Find(id); return(View(supply)); }
public ActionResult Create(Customers model, HttpPostedFileBase imageSave) { if (ModelState.IsValid) { // TODO: Add insert logic here var context = new PhoneDbContext(); if (imageSave.ContentLength > 0) { string imageFileName = Path.GetFileName(imageSave.FileName); string folderPath = Path.Combine(Server.MapPath("~/Assets/Admin/img"), imageFileName); imageSave.SaveAs(folderPath); } //Khởi tạo lớp sinh viên để thêm trước Customers cus = new Customers { Photo = imageSave.FileName }; model.Photo = cus.Photo; context.Customers.Add(model); context.SaveChanges(); //Lưu lại return(RedirectToAction("Index", "Customer")); } else { return(View()); } }
public ActionResult Edit(Suppliers model, HttpPostedFileBase imageSave) { if (ModelState.IsValid) { // TODO: Add insert logic here if (imageSave.ContentLength > 0) { string imageFileName = Path.GetFileName(imageSave.FileName); string folderPath = Path.Combine(Server.MapPath("~/Assets/Admin/img"), imageFileName); imageSave.SaveAs(folderPath); } Suppliers supp = new Suppliers { Logo = imageSave.FileName }; var context = new PhoneDbContext(); var old = context.Suppliers.Find(model.Id); old.SupplyCode = model.SupplyCode; old.Name = model.Name; old.Phone = model.Phone; old.Email = model.Email; old.Logo = supp.Logo; //old.SinhVien.HoTen = model.SinhVien.HoTen; context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } }
// GET: Supp/Edit public ActionResult Edit(int id) { var context = new PhoneDbContext(); var cus = context.Customers.Find(id); return(View(cus)); }
public static void SeedHostDb(PhoneDbContext context) { context.SuppressAutoSetTenantId = true; // Host seed new InitialHostDbBuilder(context).Create(); // Default tenant seed (in host database). new DefaultTenantBuilder(context).Create(); new TenantRoleAndUserBuilder(context, 1).Create(); }
public async Task CreateNewContact() { var options = new DbContextOptionsBuilder <PhoneDbContext>() .UseInMemoryDatabase(databaseName: "Test_PhoneBook") .Options; using (var inMemoryContext = new PhoneDbContext(options)) { var service = new PersonsController(inMemoryContext); await service.Create(new Persons { Ad = "Deneme", Soyad = "deneme soyadı", Firma = "Test Firması" }); } using (var inMemoryContext = new PhoneDbContext(options)) { Assert.Equal(1, await inMemoryContext.Persons.CountAsync()); } }
public async Task CreateNewContact() { var options = new DbContextOptionsBuilder <PhoneBook.Models.PhoneDbContext>() .UseInMemoryDatabase(databaseName: "Test_PhoneBook") .Options; using (var inMemoryContext = new PhoneDbContext(options)) { var service = new PhoneBook.Controllers.ContactsController(inMemoryContext); await service.Create(new Contacts { ContactType = Contacts.ContactTypes.Location, ContactText = "30,40" }); } using (var inMemoryContext = new PhoneDbContext(options)) { Assert.Equal(1, await inMemoryContext.Contacts.CountAsync()); } }
public ActionResult Edit(Customers model, HttpPostedFileBase imageSave) { if (ModelState.IsValid) { // TODO: Add insert logic here if (imageSave.ContentLength > 0) { string imageFileName = Path.GetFileName(imageSave.FileName); string folderPath = Path.Combine(Server.MapPath("~/Assets/Admin/img"), imageFileName); imageSave.SaveAs(folderPath); } Customers cus = new Customers { Photo = imageSave.FileName }; var context = new PhoneDbContext(); var old = context.Customers.Find(model.Id); old.Fullname = model.Fullname; old.DOB = model.DOB; old.Activated = model.Activated; old.Email = model.Email; old.Photo = cus.Photo; old.UserPassword = cus.UserPassword; //old.SinhVien.HoTen = model.SinhVien.HoTen; context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } }
internal BaseRepository(PhoneDbContext context) { _context = context; }
public DefaultSettingsCreator(PhoneDbContext context) { _context = context; }
public DefaultEditionCreator(PhoneDbContext context) { _context = context; }
public RepairsController(PhoneDbContext context) { _context = context; }
public UserDAO() { db = new PhoneDbContext(); }
public SupplyDAO() { db = new PhoneDbContext(); }
public PersonsController(PhoneDbContext context) { _context = context; }
public DefaultLanguagesCreator(PhoneDbContext context) { _context = context; }
public PhoneController(PhoneDbContext context) { _context = context; }
public CustomerDAO() { db = new PhoneDbContext(); }
public HostRoleAndUserCreator(PhoneDbContext context) { _context = context; }
public ContactsController(PhoneDbContext context) { _context = context; }
public InitialHostDbBuilder(PhoneDbContext context) { _context = context; }
public OrderRepository(PhoneDbContext context) : base(context) { }
public DefaultTenantBuilder(PhoneDbContext context) { _context = context; }
public UserController(PhoneDbContext context) { _context = context; }
public TenantRoleAndUserBuilder(PhoneDbContext context, int tenantId) { _context = context; _tenantId = tenantId; }
public ManufacturerRepository(PhoneDbContext context) : base(context) { }
public PhoneRepository(PhoneDbContext context) : base(context) { }
public ConfigrationsController(PhoneDbContext context) { _context = context; }