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; } }
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; } }
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); }