public IActionResult Edit(string description, string id, string time) { EventViewModel model = new EventViewModel(); if (time != null) { time = HomeController.CurrentDate.ToString("yyyy-MM-dd") + 'T' + time; model.Edit(id, DateTime.Parse(time), description); } else { model.Edit(id, HomeController.CurrentDate, description); } ViewBag.date = HomeController.CurrentDate; return(Redirect("/Home/Day/?date=" + HomeController.CurrentDate.ToString("yyyy-MM-dd"))); }
public JsonResult Edit(string date, string description, string id) { EventViewModel model = new EventViewModel(); DateTime dat = DateTime.Parse(date); Console.WriteLine(date); if (model.Edit(id, dat, description)) { return(new JsonResult(new { })); } else { return(new JsonResult(new { status = "fail", message = "Error while editing event" })); } }