// Cập nhật thông tin theo dõi truyện public ResponseInfo UpadateTheoDoi(int id, UpdateTheoDoi data) { DbContextTransaction transaction = context.Database.BeginTransaction(); ResponseInfo response = new ResponseInfo(); try { int idTaiKhoan = Common.Common.GetAccount().Id; context.TheoDoiTruyens.Where(x => x.Id == id && !x.DelFlag) .Update(x => new TblTheoDoiTruyen { Id_ChuongDanhDau = data.IdChuongTheoDoi, Id_NguoiDoc = idTaiKhoan }); context.SaveChanges(); response.IsSuccess = true; transaction.Commit(); var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.CapNhatDuLieuThanhCong); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; return(response); } catch (Exception e) { response.IsSuccess = false; transaction.Rollback(); throw e; } }
public ResponseInfo UpdateTheoDoi(int id, UpdateTheoDoi data) { ResponseInfo response = new ResponseInfo(); try { response = new TheoDoiTruyenModel().UpadateTheoDoi(id, data); } catch (Exception e) { response.Code = (int)ConstantsEnum.CodeResponse.ServerError; var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.ServerError); response.TypeMsgError = errorMsg.Type; response.MsgError = errorMsg.Msg; response.ThongTinBoSung1 = e.Message; } return(response); }