protected void Button_Click(object sender, EventArgs e) { Button button = (Button)sender; string buttonStartTime = button.ID.Replace("Button", "").Substring(0, 4); ScheduleHourController scheduleHourController = (ScheduleHourController)Session["ScheduleHour"]; Client client = (Client)Session["ses"]; DateTime startHour = new DateTime ( scheduleHourController.Year, scheduleHourController.Month, scheduleHourController.Day, int.Parse(buttonStartTime.Substring(0, 2)), int.Parse(buttonStartTime.Substring(2)), 0 ); Hour hour = new Hour() { RutClient = client.Rut, DateHour = startHour, RutFunctionary = scheduleHourController.FunctionaryRut }; if (hour.Create()) { scheduleHourController.TakenHour = startHour; Session["ScheduleHour"] = scheduleHourController; Response.Redirect("HoraRegistrada.aspx"); } else { Response.Redirect("Index.aspx"); } }
public Hour Create(CreateHourCommand command) { var Hour = new Hour(command.HourOfDay, command.Active, command.Reserved, command.DayId); Hour.Create(); _repository.Create(Hour); if (Commit()) { return(Hour); } return(null); }