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());
        }
示例#2
0
        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());
        }
示例#3
0
        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));
        }
示例#4
0
        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());
        }
示例#5
0
        public virtual bool Update(TEntity entityToUpdate)
        {
            _dbSet.Attach(entityToUpdate);
            _context.Entry(entityToUpdate).State = EntityState.Modified;
            _context.SaveChanges();

            return(true);
        }
示例#6
0
        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();
        }
示例#7
0
        public async Task Update(TEntity item)
        {
            _table.Attach(item);

            Context.Entry(item).State = EntityState.Modified;

            await Context.SaveChangesAsync();
        }
示例#8
0
        public void Excluir(int id)
        {
            var item = context.Cliente.Find(id);

            item.IsDeleted            = '1';
            context.Entry(item).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
        }
示例#9
0
        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"));
        }
示例#11
0
        public async Task <Product> DeleteAsync(Guid productId)
        {
            var product = await GetProductByIdAsync(productId);

            _dataBaseContext.Entry(product).State = EntityState.Deleted;
            await _dataBaseContext.SaveChangesAsync();

            return(product);
        }
示例#12
0
        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));
 }
示例#15
0
 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));
 }
示例#16
0
        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();
        }
示例#17
0
 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));
 }
示例#18
0
 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));
 }
示例#20
0
 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));
 }
示例#21
0
 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));
 }
示例#23
0
 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));
 }
示例#25
0
 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));
 }
示例#28
0
 public ActionResult Edit(Categoria categoria)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categoria).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categoria));
 }
示例#29
0
 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));
 }