コード例 #1
0
ファイル: Service1.cs プロジェクト: tcns/impulse
 public string SaveAdSession(Models.StatModels.AdSession model, bool proceedToDB = true)
 {
     context.Sessions.Add(model);
     try
     {
         if (proceedToDB)
         {
             context.SaveChanges();
         }
         return(ResponseStatuses.SUCCESS);
     }
     catch (Exception ex)
     {
         return(ResponseStatuses.BuildErrorResponse(ex.InnerException.Message));
     }
 }
コード例 #2
0
ファイル: Service1.cs プロジェクト: tcns/impulse
        public string SaveAd(Models.AdModels.SimpleAdModel model, bool proceedToDB = true)
        {
            if (context.SimpleAds.Count(a => a.ShortUrlKey.Equals(model.ShortUrlKey)) == 0)
            {
                model.IsActive = true;
            }
            if (model.ShortUrlKey != null && model.Id > 0)
            {
                var modelFromDb = GetAdById(model.Id);
                context.SimpleAds.Remove(modelFromDb);
                context.SaveChanges();

                /*context.UpdateGraph(model, map => map
                 *  .OwnedCollection(graph => graph.StateGraph)
                 *  .OwnedCollection(states => states.AdStates, with => with
                 *      .OwnedCollection(c => c.UserElements, withd => withd
                 *          .OwnedCollection(d => d.HtmlTags))
                 *      .OwnedEntity(d => d.VideoUnit))
                 *  .OwnedCollection(a => a.AdSessions, with => with
                 *      .OwnedCollection(c => c.Activities, withd => withd
                 *          .OwnedCollection(d => d.Clicks)))
                 *  .OwnedCollection(a => a.UserRequests));*/
            }
            context.SimpleAds.Add(model);
            try
            {
                if (proceedToDB)
                {
                    context.SaveChanges();
                }
                return(ResponseStatuses.SUCCESS);
            }
            catch (Exception ex)
            {
                return(ResponseStatuses.BuildErrorResponse(ex.InnerException.Message));
            }
        }
コード例 #3
0
 public ResponseModel(ResponseStatuses responseStatus, string message)
 {
     TransactionID   = Guid.NewGuid();
     ResponseStatus  = responseStatus.ToString();
     ResponseMessage = message;
 }
コード例 #4
0
 protected bool IsDataLoadSuccess(TOptions option)
 {
     return(ResponseStatuses != null && ResponseStatuses.Any(t => t.Option.Equals(option)));
 }