public IHttpActionResult Put(int id, [FromBody] EditEventExternalExhibitorModel model)
        {
            var exhibitor = db.EventExternalExhibitor.Where(u => u.Id == id).FirstOrDefault();

            if (exhibitor == null)
            {
                return(NotFound());
            }

            exhibitor.Name        = model.Name;
            exhibitor.PhoneNo     = model.PhoneNo;
            exhibitor.Email       = model.Email;
            exhibitor.Remark      = model.Remark;
            exhibitor.CompanyName = model.CompanyName;

            db.EventExternalExhibitor.Attach(exhibitor);
            db.Entry(exhibitor).Property(x => x.Name).IsModified        = true;
            db.Entry(exhibitor).Property(x => x.PhoneNo).IsModified     = true;
            db.Entry(exhibitor).Property(x => x.Email).IsModified       = true;
            db.Entry(exhibitor).Property(x => x.Remark).IsModified      = true;
            db.Entry(exhibitor).Property(x => x.CompanyName).IsModified = true;

            db.Entry(exhibitor).Property(x => x.Display).IsModified = false;
            db.Entry(exhibitor).Property(x => x.Id).IsModified      = false;

            db.Configuration.ValidateOnSaveEnabled = true;
            db.SaveChanges();

            return(Ok(true));
        }
        public async Task <ActionResult> Edit(EditEventExternalExhibitorModel model)
        {
            var nameResponse = await WepApiMethod.SendApiAsync <bool>(HttpVerbs.Get, $"eEvent/EventExternalExhibitor/IsNameExist?id={model.Id}&name={model.Name}");

            if (nameResponse.isSuccess)
            {
                TempData["ErrorMessage"] = " Name already exist in the system";
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                var response = await WepApiMethod.SendApiAsync <bool>(HttpVerbs.Put, $"eEvent/EventExternalExhibitor?id={model.Id}", model);

                if (response.isSuccess)
                {
                    TempData["SuccessMessage"] = "External Exhibitor successfully updated";

                    return(RedirectToAction("List"));
                }
            }

            TempData["ErrorMessage"] = "Fail to update EventExternalExhibitor";

            return(RedirectToAction("List"));
        }