public Agent UpdateAgent(Agent agent)
 {
     using (var emlakOfiDbContext = new EmlakOfisiDbContext())
     {
         emlakOfiDbContext.Agents.Update(agent);
         emlakOfiDbContext.SaveChanges();
         return(agent);
     }
 }
 public Advertisement UpdateAdvertisement(Advertisement advertisement)
 {
     using (var emlakOfiDbContext = new EmlakOfisiDbContext())
     {
         emlakOfiDbContext.Advertisements.Update(advertisement);
         emlakOfiDbContext.SaveChanges();
         return(advertisement);
     }
 }
 public void DeleteAgent(int id)
 {
     using (var emlakOfiDbContext = new EmlakOfisiDbContext())
     {
         var deleted = GetAgentById(id);
         emlakOfiDbContext.Agents.Remove(deleted);
         emlakOfiDbContext.SaveChanges();
     }
 }
 public void DeleteAdvertisement(int id)
 {
     using (var emlakOfisDbContext = new EmlakOfisiDbContext())
     {
         var deleted = GetAdvertisementByExpression(x => x.Id == id);
         emlakOfisDbContext.Advertisements.Remove(deleted);
         emlakOfisDbContext.SaveChanges();
     }
 }