public async Task <BaseResult <bool> > Disable(string carousel_id, string disable_desc, int type) { if (carousel_id.Length <= 0) { return(new BaseResult <bool>(808)); } //首先查询数据读取原始的desc var str = ""; var carouselEntity = await carouselRepository.GetAsync(c => c.carousel_id.Equals(carousel_id)); if (string.IsNullOrEmpty(carouselEntity.disabledesc)) { str = "{'disable':'" + carouselEntity.disable + "','disable_desc':'" + disable_desc + "'}"; } else { str = carouselEntity.disabledesc + ",{'disable':'" + carouselEntity.disable + "','disable_desc':'" + disable_desc + "'}"; } CarouselEntity vmodel = new CarouselEntity() { carousel_id = carousel_id, disabledesc = str, disable = type }; var isTrue = await carouselRepository.UpdateAsync(vmodel, true, true, c => c.disable, c => c.disabledesc); if (!isTrue) { return(new BaseResult <bool>(201, false)); } return(new BaseResult <bool>(200, true)); }
public async Task <BaseResult <bool> > Update(CarouselEntity carouselEntity) { //判断必须传递参数 if (string.IsNullOrEmpty(carouselEntity.carousel_titie)) { return(new BaseResult <bool>(808, false)); } var isTrue = await carouselRepository.UpdateAsync(carouselEntity, true, true, c => c.carousel_image, c => c.carousel_titie, c => c.carousel_conent, c => c.carousel_href, c => c.carousel_sort); if (!isTrue) { return(new BaseResult <bool>(201, false)); } return(new BaseResult <bool>(200, true)); }
public async Task <BaseResult <bool> > Delete(string id) { if (string.IsNullOrEmpty(id)) { return(new BaseResult <bool>(808)); } CarouselEntity carouselEntity = new CarouselEntity() { carousel_id = id }; var isTrue = await carouselRepository.DeleteAsync(carouselEntity); if (!isTrue) { return(new BaseResult <bool>(201, false)); } return(new BaseResult <bool>(200, true)); }
public Task <BaseResult <bool> > Add(CarouselEntity carouselEntity) { throw new NotImplementedException(); }