public ActionResult Edit(FormCollection form) { if (form["DeleteLesson"] == "on") { _timeTableService.DeleteEvent(new Guid(form["Id"])); } else { var eventDto = _timeTableService.GetEventDTOById(new Guid(form["Id"])); eventDto.Text = form["Text"]; eventDto.TeacherName = form["TeacherName"]; int roomNumber = 0; Int32.TryParse(form["RoomNumber"], out roomNumber); eventDto.RoomNumber = roomNumber; _timeTableService.UpdateEvent(eventDto); } return(JavaScript(SimpleJsonSerializer.Serialize("OK"))); }