public IActionResult Edit(int id) { var model = tokhaiService.GetTokhai(id); var ToKhaiEdit = new EditToKhai(); if (model != null) { ToKhaiEdit.id = model.id; ToKhaiEdit.Address = model.Address; ToKhaiEdit.BirthYear = model.BirthYear; ToKhaiEdit.Email = model.Email; ToKhaiEdit.FullName = model.FullName; ToKhaiEdit.Gender = model.Gender; ToKhaiEdit.GateId = model.GateId; ToKhaiEdit.VietNam = model.VietNam; ToKhaiEdit.HoChieu = model.HoChieu; ToKhaiEdit.tauBay = model.tauBay; ToKhaiEdit.tauThuyen = model.tauThuyen; ToKhaiEdit.oTo = model.oTo; ToKhaiEdit.other = model.other; ToKhaiEdit.Sohieu = model.Sohieu; ToKhaiEdit.SoGhet = model.SoGhet; ToKhaiEdit.startDay = model.startDay; ToKhaiEdit.startMonth = model.startMonth; ToKhaiEdit.startYear = model.startYear; ToKhaiEdit.VietNam_e = model.VietNam_e; ToKhaiEdit.IdTihhe = model.IdTihhe; ToKhaiEdit.IdTinhs = model.IdTinhs; ToKhaiEdit.VietNam_s = model.VietNam_s; ToKhaiEdit.denquocgia = model.denquocgia; ToKhaiEdit.idProvince = model.idProvince; ToKhaiEdit.idDistrict = model.idDistrict; ToKhaiEdit.idWard = model.idWard; ToKhaiEdit.PhoneNumber = model.PhoneNumber; ToKhaiEdit.Sot = model.Sot; ToKhaiEdit.Ho = model.Ho; ToKhaiEdit.Khotho = model.Khotho; ToKhaiEdit.Dauhong = model.Dauhong; ToKhaiEdit.Non = model.Non; ToKhaiEdit.Tieuchay = model.Tieuchay; ToKhaiEdit.xuatHuyet = model.xuatHuyet; ToKhaiEdit.NoiBan = model.NoiBan; ToKhaiEdit.vacxin = model.vacxin; ToKhaiEdit.tiepxuc = model.tiepxuc; ToKhaiEdit.dongvat = model.dongvat; ToKhaiEdit.entryDay = model.entryDay; ToKhaiEdit.entryMonth = model.entryMonth; ToKhaiEdit.entryYear = model.entryYear; ToKhaiEdit.Provinces = tokhaiService.GetProvinces(); ToKhaiEdit.Districts = tokhaiService.GetDistricts(ToKhaiEdit.idProvince); ToKhaiEdit.Wards = tokhaiService.GetWards(ToKhaiEdit.idProvince, ToKhaiEdit.idDistrict); } return(View(ToKhaiEdit)); }
public IActionResult Edit(UpdateToKhai model) { if (ModelState.IsValid) { if (tokhaiService.UpdateToKhai(model) > 0) { return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "System error, please try again later!"); } var editToKhai = new EditToKhai(); return(View(editToKhai)); }