Пример #1
0
 public FavDTO UpdateFav(FavDTO model)
 {
     try
     {
         FavLogoTitle fav = db.FavLogoTitles.First();
         FavDTO       dto = new FavDTO();
         dto.ID   = model.ID;
         dto.Fav  = fav.Fav;
         dto.Logo = fav.Logo;
         // Update Fav in DB.
         fav.Title = model.Title;
         if (model.Fav != null)
         {
             fav.Fav = model.Fav;
         }
         if (model.Logo != null)
         {
             fav.Logo = model.Logo;
         }
         db.SaveChanges();
         return(dto);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
        public FavDTO UpdateUser(FavDTO model)
        {
            try
            {
                FavLogoTitle fav = db.FavLogoTitles.First();
                FavDTO       dto = new FavDTO();
                dto.ID    = fav.ID;
                fav.Title = model.Title;
                dto.Fav   = fav.Fav;
                dto.Logo  = fav.Logo;
                if (model.Fav != null)
                {
                    fav.Fav = model.Fav;
                }
                if (model.Logo != null)
                {
                    fav.Logo = model.Logo;
                }
                fav.LastUpdateDate   = DateTime.Now;
                fav.LastUpdateUserID = UserStatic.UserID;

                db.SaveChanges();
                return(dto);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public FavDTO GetFav()
        {
            FavLogoTitle fav = db.FavLogoTitles.First();
            FavDTO       dto = new FavDTO();

            dto.ID    = fav.ID;
            dto.Title = fav.Title;
            dto.Logo  = fav.Logo;
            dto.Fav   = fav.Fav;
            return(dto);
        }