Esempio n. 1
0
        public WidgetConfModel AddWidgetConf(int widgetId, UserPublicModel user, WidgetConfCreationModel newConf)
        {
            var widget = _widgetRepository.GetWidgetById((uint)widgetId);

            if (widget == null)
            {
                return(null);
            }

            var widgetConf = new WidgetConfModel
            {
                Conf     = newConf.Conf,
                WidgetId = (uint)widgetId,
                UserId   = user.Id
            };

            return(_widgetConfRepository.AddNewWidgetConf(widgetConf) == 1
                ? _widgetConfRepository.GetLastWidgetConfByUserId(user.Id)
                : null);
        }
Esempio n. 2
0
 public int UpdateWidgetConf(WidgetConfModel target, WidgetConfModel model)
 {
     _context.Entry(target).CurrentValues.SetValues(model);
     return(_context.SaveChanges());
 }
Esempio n. 3
0
 public int AddNewWidgetConf(WidgetConfModel model)
 {
     _repository.Add(model);
     return(_context.SaveChanges());
 }
Esempio n. 4
0
 public int DeleteWidgetConf(WidgetConfModel model)
 {
     _repository.Remove(model);
     return(_context.SaveChanges());
 }