public string GetAdsdetailsById(string AdsId) { try { Domain.Myfashion.Domain.Ads objAds = objAdsRepo.getAdsDetailsbyId(Guid.Parse(AdsId)); return(new JavaScriptSerializer().Serialize(objAds)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public string UpdateAdvertisement(string ObjAdvertisement) { try { Domain.Myfashion.Domain.Ads ObjAds = (Domain.Myfashion.Domain.Ads)(new JavaScriptSerializer().Deserialize(ObjAdvertisement, typeof(Domain.Myfashion.Domain.Ads))); objAdsRepo.UpdateAds(ObjAds); return(new JavaScriptSerializer().Serialize("Updated Successfully")); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } }
public string AddAdvertisement(string ObjAdvertisement, string Advertise) { try { if (objAdsRepo.checkAdsExists(Advertise)) { Domain.Myfashion.Domain.Ads ObjAds = (Domain.Myfashion.Domain.Ads)(new JavaScriptSerializer().Deserialize(ObjAdvertisement, typeof(Domain.Myfashion.Domain.Ads))); objAdsRepo.UpdateAds(ObjAds); return(new JavaScriptSerializer().Serialize("Success")); } else { Domain.Myfashion.Domain.Ads ObjAds = (Domain.Myfashion.Domain.Ads)(new JavaScriptSerializer().Deserialize(ObjAdvertisement, typeof(Domain.Myfashion.Domain.Ads))); objAdsRepo.AddAds(ObjAds); return(new JavaScriptSerializer().Serialize("Success")); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } }