public ActionResult HostInfo(int id) { if (Session["Identity"] == null) { return RedirectToAction("login"); } var dd = context.getEmpolyeeById(id); IQueryable<getAllTaxiInformationResult> taxi = context.getAllTaxiInformation(); List<getAllTaxiInformationResult> taxilist = new List<getAllTaxiInformationResult>(); foreach (getAllTaxiInformationResult tx in taxi) { if (tx.host_empolyee_id == id) taxilist.Add(tx); } string photo = context.getHostById(id).First().photo; getEmpolyeeByIdResult g = dd.First(); List<getAllFirmResult> firm = context.getAllFirm().ToList(); String firm_name = ""; foreach (getAllFirmResult tx in firm) { if (tx.firm_id == g.firm_id) firm_name = tx.firm_name; } ShowHostModal detail = new ShowHostModal() { employee_id = g.empolyee_id, address = g.empolyee_address, gender = g.gender, id_card = g.id_card, name = g.name, telephone = g.telephone, taxi_list = taxilist, firm_name = firm_name, birthday = g.birthday.ToShortDateString(), photo = photo /*, is_available = t.is_available, plate_number = t.plate_number, taxi_brand = t.taxi_brand * */ }; ViewData.Model = detail; return View(); }
public ActionResult EditHost(int id) { if (Session["Identity"] == null) { return RedirectToAction("login"); } var dd = context.getEmpolyeeById(id); getEmpolyeeByIdResult g = dd.First(); ShowHostModal detail = new ShowHostModal() { address = g.empolyee_address, gender = g.gender, id_card = g.id_card, name = g.name, telephone = g.telephone, /* is_available = t.is_available, plate_number = t.plate_number, taxi_brand = t.taxi_brand * */ }; ViewData.Model = detail; ViewData["id"] = id + ""; return View(); }
public ActionResult EditHost(int id, ShowHostModal modal) { if (Session["Identity"] == null) { return RedirectToAction("login"); } try { StringBuilder info = new StringBuilder(); String bas = ""; foreach (string file in Request.Files) { HttpPostedFileBase postFile = Request.Files[file]; if (postFile.ContentLength == 0) continue; string newFilePath = Server.MapPath("/Content/HostPhoto/host"); postFile.SaveAs(newFilePath + id); bas = "/Content/HostPhoto/host" + id; info.AppendFormat("Upload File: {0}/r/n", postFile.FileName); } context.setHostPhoto(id, bas); // TODO: Add update logic here return RedirectToAction("HostList"); } catch { return View(); } }
public ActionResult HostInfo(int id) { var dd = context.getEmpolyeeById(id); getTaxiByOwnerEmpolyeeIdResult t = context.getTaxiByOwnerEmpolyeeId(id).First(); getEmpolyeeByIdResult g = dd.First(); ShowHostModal detail = new ShowHostModal() { address = g.empolyee_address, gender = g.gender, id_card = g.id_card, name = g.name, telephone = g.telephone, is_available = t.is_available, plate_number = t.plate_number, taxi_brand = t.taxi_brand }; ViewData.Model = detail; return View(); }