public JsonResult Delete(int id) { try { tQuestionServiceClient client = new tQuestionServiceClient(); ViewtQuestion model = client.GetById(id); model.IsDelete = true; client.Edit(model); return(Json(new { code = 0 })); } catch { return(Json(new { code = 1 })); } }
public JsonResult Reply(ViewtQuestion model) { try { tQuestionServiceClient client = new tQuestionServiceClient(); ViewtQuestion entity = client.GetById(model.ID); entity.ReplyContent = model.ReplyContent; entity.ReplyUid = model.ReplyUid; entity.ReplyTime = DateTime.Now; entity.State = 2; client.Edit(entity); return(Json(new { code = 0 })); } catch { return(Json(new { code = 1 })); } }
public JsonResult Update(ViewtQuestion model) { try { tQuestionServiceClient client = new tQuestionServiceClient(); ViewtQuestion entity = client.GetById(model.ID); entity.TitleID = model.TitleID; entity.Hot = model.Hot; entity.QuestionContent = model.QuestionContent; entity.ReplyContent = model.ReplyContent; entity.ReplyUid = model.ReplyUid; //回答时间在这里作为修改时间 entity.ReplyTime = DateTime.Now; client.Edit(entity); return(Json(new { code = 0 })); } catch { return(Json(new { code = 1 })); } }