public ActionResult Update(ProfileFormStub model) { if (ModelState.IsValid) { owner dbItem = RepoOwner.FindByPk(model.Id); Guid idOwner = (User as CustomPrincipal).IdOwner.Value; dbItem = model.GetProfile(dbItem, idOwner); dbItem.updated_by = (User as CustomPrincipal).Identity.Name; dbItem.updated_time = DateTimeOffset.Now; try { RepoOwner.Save(dbItem); } catch (Exception e) { //model.FillCarModelOptions(RepoCarModel.FindAll()); return(View("")); } //message string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "EditSuccess").ToString(); this.SetMessage("Profil", template); return(RedirectToAction("Update")); } else { owner owner = RepoOwner.FindByPk(model.Id); ViewBag.name = owner.logo; //model.FillCarModelOptions(RepoCarModel.FindAll()); return(View("Update", model)); } }
public ActionResult Index() { var model = new ProfileFormStub(); return(View()); }
//[MvcSiteMapNode(Title = "Mobil", ParentKey = "Dashboard",Key="IndexCar")] //[SiteMapTitle("Breadcrumb")] public ActionResult Update() { Guid idOwner = (User as CustomPrincipal).IdOwner.Value; // Ngambil nilai idOwner dari session owner owner = RepoOwner.FindByPk(idOwner); // mengambil nilai owner dari repository yang idowner nya bernilai sama ProfileFormStub formStub = new ProfileFormStub(owner); // memasukan data owner dari repository ke formstub ViewBag.name = owner.name; return(View(formStub)); }