public ActionResult AddApp(CustomAppoinmentModel app) { var id = System.Web.HttpContext.Current.User.Identity.GetUserId(); app.CreatedBy = id; AppointmentService.AddAppointment(app); return(Json(true, JsonRequestBehavior.AllowGet)); }
public static void DeleteAppointment(CustomAppoinmentModel source) { using (var db = new KaamShaamEntities()) { var dbObj = db.Appointments.FirstOrDefault(app => app.Id == source.Id); if (dbObj != null) { db.Appointments.Remove(dbObj); } db.SaveChanges(); } }
public static void EditAppointment(CustomAppoinmentModel source) { using (var db = new KaamShaamEntities()) { var dbObj = db.Appointments.FirstOrDefault(app => app.Id == source.Id); if (dbObj != null) { dbObj.DateTime = source.DateTime; dbObj.Title = source.Title; dbObj.Type = source.Type; dbObj.WithId = source.WithId; dbObj.IsAttended = source.IsAttended; } db.SaveChanges(); } }
public static void AddAppointment(CustomAppoinmentModel source) { using (var db = new KaamShaamEntities()) { db.Appointments.Add(new Appointment { DateTime = source.DateTime, CreatedBy = source.CreatedBy, Title = source.Title, Type = source.Type, WithId = source.WithId, IsAttended = false }); db.SaveChanges(); } }
public ActionResult Update(CustomAppoinmentModel app) { AppointmentService.EditAppointment(app); return(Json(true, JsonRequestBehavior.AllowGet)); }