예제 #1
0
        public IHttpActionResult PutJobAd(int id, JobAd jobAd)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != jobAd.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JobAdExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "Id,ApplyStatus")] Apply apply)
 {
     if (ModelState.IsValid)
     {
         db.Entry(apply).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(apply));
 }
 public ActionResult Edit([Bind(Include = "Id,Position,ImageUrl,StudentProfile,Location,CreateOn,ValidUntil,Description,IsDeleted")] JobAd jobAd)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobAd).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jobAd));
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "Id,CreatedDate,RequiredByDate,TaskDescription,TaskStatus,TaskType,NextActionDate,UserID")] TaskModel taskModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(taskModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.Users, "Id", "Email", taskModel.UserID);
     return(View(taskModel));
 }
        public virtual async Task <T> GetByIdAsync(Guid id)
        {
            var entity = await _context.Set <T>().FindAsync(id);

            if (entity == null)
            {
                throw new NotFoundException();
            }

            _context.Entry(entity).State = EntityState.Detached;
            return(entity);
        }