public GroupNotification add(GroupNotification store) { logger.Info("Add Store: "); try { if (store == null) { throw new ArgumentNullException("Store"); } List <Customer> customers = new List <Customer>(); foreach (var item in store.Customer) { Customer cuslist = context.Customers.Where(x => x.CustomerId == item.CustomerId).FirstOrDefault(); customers.Add(cuslist); } store.Customer = customers; context.AddGroupNotification(store); logger.Info("End Add Store: "); return(store); } catch (Exception ex) { logger.Error("Error in Add Store " + ex.Message); return(null); } }
public JsonResult Edit(GroupNotification notifi) { var db = new VITVSecondContext(); db.Entry(notifi).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Json(new { success = true })); }
public JsonResult Add(GroupNotification notifi) { var db = new VITVSecondContext(); db.GroupNotifications.Add(notifi); db.SaveChanges(); return(Json(new { success = true })); }
public virtual void Subscribe(EmailSubscriptionViewModel subscription) { if (Request.IsAjaxRequest()) { try { // Add logic to add subscr var isGroup = subscription.SubscriptionType.Contains("Group"); var isTag = subscription.SubscriptionType.Contains("tag"); var id = subscription.Id; var dbUser = MembershipService.GetUser(User.Identity.Name); if (isGroup) { // get the Group var cat = _groupService.Get(id); if (cat != null) { // Create the notification var GroupNotification = new GroupNotification { Group = cat, User = dbUser }; //save _notificationService.Add(GroupNotification); } } else if (isTag) { // get the tag var tag = _topicTagService.Get(id); if (tag != null) { // Create the notification var tagNotification = new TagNotification { Tag = tag, User = dbUser }; //save _notificationService.Add(tagNotification); } } else { // get the Group var topic = _topicService.Get(id); // check its not null if (topic != null) { // Create the notification var topicNotification = new TopicNotification { Topic = topic, User = dbUser }; //save _notificationService.Add(topicNotification); } } Context.SaveChanges(); } catch (Exception ex) { Context.RollBack(); LoggingService.Error(ex); throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage")); } } else { throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage")); } }
/// <inheritdoc /> public GroupNotification Add(GroupNotification Group) { return(_context.GroupNotification.Add(Group)); }
/// <inheritdoc /> public void Delete(GroupNotification notification) { _context.GroupNotification.Remove(notification); }