public bool AddAds(AdvertisementDataModel model) { using (var connection = new SqlConnection(connectionString)) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@id", model.Id), new SqlParameter("@section", model.Section), new SqlParameter("@order", model.Order), new SqlParameter("@jobpage", model.JobPage), new SqlParameter("@imageurl", model.ImagePath), }; try { var result = SqlHelper.ExecuteNonQuery ( connection, CommandType.StoredProcedure, "usp_AddAdvertisements", parameter ); if (result > 0) { return(true); } } finally { SqlHelper.CloseConnection(connection); } } return(false); }
public bool UpdateAds(AdvertisementsViewModel model, int userid) { var ads = new AdvertisementDataModel { Id = model.Id, ImagePath = model.ImagePath, Section = model.Section, Order = model.Order, JobPage = model.JobPage }; return(_advertisementsRepository.UpdateAds(ads, userid)); }
public bool AddAds(AdvertisementsViewModel model) { var ads = new AdvertisementDataModel { Id = model.Id, ImagePath = model.ImagePath, Section = model.Section, Order = model.Order, JobPage = model.JobPage }; return(_advertisementsRepository.AddAds(ads)); }