이벤트 연기 이벤트 시작일을 연기 날짜로 변경 하시겠습니까? 폼이보기 내 연기되는 이벤트 시작 날짜 및 이벤트 종료 날짜asp.net mvc 업데이트 날짜가 변경 될 때
public ActionResult Postpone(int ID)
{
var events = db.Events.Find(ID);
return PartialView(events);
}
//
// POST: /Events/Postpone/5
[HttpPost]
public ActionResult Postpone(FormCollection Collection)
{
var ID = Collection["Event_ID"];
int intID = int.Parse(ID);
var events = db.Events.Find(intID);
// If OK to Postpone , set status to P
events.Event_Status = "P";
if (TryUpdateModel(events))
{
//LIke to have option to change Event on the Form
db.SaveChanges();
string ConfirmMessage = "Event Successfully Postponed";
return RedirectToAction("Confirm", "Admin", new { ConfirmMessage = ConfirmMessage });
}
else
{
return PartialView(events);
}
}
를 업데이트하기 위해 반환해야
@model MvcEvents.Models.Event
<h3>Are you sure you want to Postpone this?</h3>
@using (Ajax.BeginForm("Postpone", "Admin", new AjaxOptions { UpdateTargetId = "my-modal- dialog", OnBegin = "Dialog.Updating()", OnSuccess = "Dialog.Update()" }))
{
<fieldset>
<legend>Event</legend>
@Html.HiddenFor(model => model.Event_ID)
<div class="display-label">Event Location</div>
<div class="display-field">@Html.DisplayFor(model => model.Section.City)</div>
<div class="display-label">Event Start Date</div>
<div class="display-field"> @Html.DisplayFor(model => model.Event_Start) </div>
<div class="display-label">Event End Date</div>
<div class="display-field">@Html.DisplayFor(model => model.Event_End)</div>
<div class="display-label">Event Description</div>
<div class="display-field">@Html.DisplayFor(model => model.Event_Description)
</div>
</fieldset>
<p>
<input type="submit" value="Postpone" class="demo-button ui-state-default ui-corner-all" />
</p>
}
생각 너의 질문? 이 코드에 어떤 문제가 있습니까? 무슨 일이 일어날 것으로 예상됩니까? –
연기하기 위해 클릭 할 때, 내가 선택한 연기 연기 날짜로 이벤트 시작일을 변경할 수 있도록 반환 할 양식이 필요합니다. 이벤트 시작 날짜 행은 이벤트에 저장됩니다. – Alss
현재 양식을 반환하지 않는다는 의미입니까? 당신도 당신의 의견을 게시 할 수 있습니까? –