public ActionResult Create(Appointment NewAppointment) { try { this._appointmentRepository.CreateAppointment(NewAppointment); return RedirectToAction("Index", "FullCalendar"); } catch { return View(); } }
/// <summary> /// Create new appointment /// </summary> /// <param name="NewAppointment"></param> /// <returns></returns> public string CreateAppointment(Appointment NewAppointment) { string query = @"insert into [dbo].[AppointmentDiary] ([Title] ,[CompanyId] ,[BranchId] ,[CustomerId] ,[PackageId] ,[DateTimeScheduled] ,[AppointmentLength] ,[Notes] ,[StatusENUM]) values (@Title, @CompanyId, @BranchId, @CustomerId, @PackageId, @DateTimeScheduled, @AppointmentLength, @Notes, @StatusENUM)"; //create new appointment in db _con.Query<int>(query, NewAppointment); return "success"; }