public AjaxModel<PrintQueueModel> Post(PrintQueueItem item) { AjaxModel<PrintQueueModel> ajax = null; try { PosRepository.PrintQueueRemove(item); ajax = new AjaxModel<PrintQueueModel>() { Success = true, Message = PosMessage.PrintQueueDeleteSuccessful, Model = null }; } catch (Exception e) { ajax = new AjaxModel<PrintQueueModel>() { Success = false, Message = PosMessage.PrintQueueDeleteError + " - " + e.Message, Model = null }; } return ajax; }
public static void PrintQueueRemove(PrintQueueItem item) { using (var db = new PosEntities()) { var queueItem = (from queue in db.PrintQueues where queue.PrintQueueID == item.PrintQueueID select queue).First(); db.PrintQueues.Remove(queueItem); db.SaveChanges(); } }
public static void PrintQueueAdd(PrintQueueItem item) { using(var db = new PosEntities()) { PrintQueue queue = new PrintQueue() { ExamID = item.ExamID, UserName = item.UserName, PrintExamNote = item.PrintExamNote }; db.PrintQueues.Add(queue); db.SaveChanges(); } }