public static BaseResultModel <Message> DeleteMessages(string Id) { int id = Int32.Parse(Id); BaseResultModel <Message> result = new BaseResultModel <Message>(); try{ using (CDBContext _cDBContext = new CDBContext()){ Message ms = new Message(); ms = _cDBContext.Me.FirstOrDefault(p => p.Id == id); _cDBContext.Remove(ms); _cDBContext.SaveChanges(); result.status = 1; result.Data = null; result.message = "邮件删除成功!"; } }catch (Exception ex) { result.status = 0; result.Data = null; result.message = ex.ToString(); } return(result); }
public static BaseResultModel <ScrollPicture> DeleteScrollPic(string Id) { int id = Int32.Parse(Id); BaseResultModel <ScrollPicture> result = new BaseResultModel <ScrollPicture>(); try{ using (CDBContext _cDBContext = new CDBContext()){ ScrollPicture sps = new ScrollPicture(); sps = _cDBContext.Sc.FirstOrDefault(p => p.Id == id); _cDBContext.Remove(sps); _cDBContext.SaveChanges(); result.status = 1; result.Data = null; result.message = "删除轮播图添加成功"; } }catch (Exception ex) { result.status = 0; result.Data = null; result.message = ex.ToString(); } return(result); }