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); }
public int UpdateWidgetConf(WidgetConfModel target, WidgetConfModel model) { _context.Entry(target).CurrentValues.SetValues(model); return(_context.SaveChanges()); }
public int AddNewWidgetConf(WidgetConfModel model) { _repository.Add(model); return(_context.SaveChanges()); }
public int DeleteWidgetConf(WidgetConfModel model) { _repository.Remove(model); return(_context.SaveChanges()); }