public async Task <IActionResult> PutCompany(long id, Company company)
        {
            if (id != company.CompanyId)
            {
                return(BadRequest());
            }
            if (CheckIfDataIsFull(company))
            {
                _context.Entry(company).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(NoContent());
        }
        public async Task <IHttpActionResult> PutCompany(int id, Company company)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != company.companyID)
            {
                return(BadRequest());
            }

            db.Entry(company).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CompanyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Description")] Reclamo reclamo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reclamo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reclamo));
 }
 public ActionResult Edit([Bind(Include = "CompanyId,Name,Ticker,Asset,Debt,Liquidity,Assessment")] Company company)
 {
     if (ModelState.IsValid)
     {
         db.Entry(company).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(company));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "ID,Name,Age")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Email,Phone,BookingTime,ServiceID")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ServiceID = new SelectList(db.Services, "ID", "Title", booking.ServiceID);
     return(View(booking));
 }
 public ActionResult Edit([Bind(Include = "ID,Title,Description,Duration,Spaces,Price,Rating,Availability,CompanyID")] Service service)
 {
     if (ModelState.IsValid)
     {
         db.Entry(service).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyID = new SelectList(db.Companies, "ID", "Name", service.CompanyID);
     return(View(service));
 }
Example #8
0
        public ActionResult Edit([Bind(Include = "ID,CompanyName,Description,Logo")] CompanyProfileViewModel companyProfile)
        {
            if (ModelState.IsValid)
            {
                Company company = db.Companies.Find(companyProfile.ID);
                //company.ID = companyProfile.ID;
                company.CompanyName = companyProfile.CompanyName;
                company.Description = companyProfile.Description;

                if (company.Logo == null || company.Logo == "")
                {
                    companyProfile.Logo = "LogoPlaceholder.jpg";
                }
                else
                {
                    companyProfile.Logo = company.Logo;
                }

                db.Entry(company).State = EntityState.Modified;
                db.SaveChanges();
                return(View(companyProfile));
            }
            return(View(companyProfile));
        }
Example #9
0
 public virtual void Update(T entity)
 {
     dbset.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }
 public void UpdateEmployee(Employee employee)
 {
     context.Entry(employee).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }