public async Task <IActionResult> PutUser(Guid id, User user) { if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutProducts(int id, Products products) { if (id != products.Id) { return(BadRequest()); } _context.Entry(products).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IHttpActionResult PutMarca(int id, Marca marca) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != marca.Id) { return(BadRequest()); } db.Entry(marca).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MarcaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutFourth([FromRoute] int id, [FromBody] Fourth fourth) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fourth.ID) { return(BadRequest()); } _context.Entry(fourth).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FourthExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual bool Update(TEntity entityToUpdate) { _dbSet.Attach(entityToUpdate); _context.Entry(entityToUpdate).State = EntityState.Modified; _context.SaveChanges(); return(true); }
public void EditExplosivesData(ExplosiveData explosiveData) { var explosive = _dataBase.ExplosiveData.FirstOrDefault(data => data.Id == explosiveData.Id); _dataBase.Entry(explosive).CurrentValues.SetValues(explosiveData); _dataBase.ExplosiveData.Update(explosive); _dataBase.SaveChanges(); }
public async Task Update(TEntity item) { _table.Attach(item); Context.Entry(item).State = EntityState.Modified; await Context.SaveChangesAsync(); }
public void Excluir(int id) { var item = context.Cliente.Find(id); item.IsDeleted = '1'; context.Entry(item).State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); }
public ActionResult EditarCliente(ClienteModel clientemodref) { clientemodref.dataCriacao = DateTime.Now; db.Entry(clientemodref).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ConsultaClientes")); }
public ActionResult EditarProduto(ProdutoModel produtomodref) { produtomodref.dataCriacaoProduto = DateTime.Now; db.Entry(produtomodref).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ConsultaProduto")); }
public async Task <Product> DeleteAsync(Guid productId) { var product = await GetProductByIdAsync(productId); _dataBaseContext.Entry(product).State = EntityState.Deleted; await _dataBaseContext.SaveChangesAsync(); return(product); }
public async Task <ProductOption> DeleteOptionByProductIdAndOptionIdAsync(Guid id, Guid optionId) { var option = await GetOptionByProductIdAndOptionIdAsync(id, optionId); _dataBaseContext.Entry(option).State = EntityState.Deleted; await _dataBaseContext.SaveChangesAsync(); return(option); }
public async void DeleteTypeFoLetterIfCountMoreThenMAX(int MAXCoun, int numberOfType, DataBaseContext db, UserProfile user) { if (db.listTypesOfLetter[numberOfType].Count(x => x.OrderUser.Id == user.Id) == MAXCoun) { var someTypeOfLetter = await db.listTypesOfLetter[numberOfType].FirstAsync(x => x.OrderUser.Id == user.Id && x.Data == db.listTypesOfLetter[numberOfType].Min(y => y.Data)); db.Entry(someTypeOfLetter).State = EntityState.Deleted; } }
public ActionResult Edit([Bind(Include = "ID,Namjestaj,Parking,WiFi,Lift,Klima,Balkon,Novogradnja,Alarm,Videonadzor,TV")] Models.Filter filter) { if (ModelState.IsValid) { db.Entry(filter).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(filter)); }
public ActionResult Edit([Bind(Include = "id,RegisteredCompanyid,FullName,HigherDate,JobRoleid,Availabilityid")] Employees employees) { if (ModelState.IsValid) { db.Entry(employees).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employees)); }
public void AddText(Text newText) { var session = _httpContextAccessor.HttpContext.Session; newText.PublisherId = (int)session.GetInt32("UserId"); newText.Time = DateTime.Now; _context.Entry(newText).State = EntityState.Added; _context.SaveChanges(); }
public ActionResult Edit([Bind(Include = "Id,Name,Address,Branch,Contact")] Vendor vendor) { if (ModelState.IsValid) { db.Entry(vendor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vendor)); }
public ActionResult Edit([Bind(Include = "ID,SmjestajId,KorisnikId,NacinPlacanja,Dugovanja,DatDolaska,DatOdlaska")] Rezervacija rezervacija) { if (ModelState.IsValid) { db.Entry(rezervacija).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rezervacija)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description")] Unit unit) { if (ModelState.IsValid) { db.Entry(unit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unit)); }
public ActionResult Edit([Bind(Include = "id,CompanyName")] RegisteredCompany registeredCompany) { if (ModelState.IsValid) { db.Entry(registeredCompany).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(registeredCompany)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Address, Email")] RentalCustomer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "id,Number,Password,Name,Phone")] Guider guider) { if (ModelState.IsValid) { db.Entry(guider).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guider)); }
public ActionResult Edit([Bind(Include = "Id,Name,Founded,WinCup,Payed")] FormaOneTeam formaOneTeam) { if (ModelState.IsValid) { db.Entry(formaOneTeam).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(formaOneTeam)); }
public ActionResult Edit([Bind(Include = "UID,account,password,city,village,address")] UserData userData) { if (ModelState.IsValid) { db.Entry(userData).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userData)); }
public ActionResult Edit([Bind(Include = "ID,Name")] PackType packType) { if (ModelState.IsValid) { db.Entry(packType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(packType)); }
public ActionResult Edit([Bind(Include = "DifficultyID,Wording")] Difficulty difficulty) { if (ModelState.IsValid) { db.Entry(difficulty).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("GetAllDifficulty")); } return(View(difficulty.MapToDifficultyViewModel())); }
public ActionResult Edit([Bind(Include = "Id,Name")] Group group) { if (ModelState.IsValid) { db.Entry(group).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(group)); }
public ActionResult Edit(Categoria categoria) { if (ModelState.IsValid) { db.Entry(categoria).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoria)); }
public ActionResult Edit(ProductModel productmodel) { if (ModelState.IsValid) { db.Entry(productmodel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productmodel)); }
public ActionResult Edit([Bind(Include = "id,title,date,start,end,RegisteredCompanyid")] Requests requests) { if (ModelState.IsValid) { db.Entry(requests).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(requests)); }